This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for

Enumeration is the process of accessing every object in a directory or folder to determine whether the object has changed and whether changed objects meet the selection criteria.

  1. The service manager calls IReplStore::IsFolderChanged.

  2. If IReplStore::IsFolderChangedreturns TRUE, the service manager calls IReplStore::FindFirstItem.

  3. If additional objects exist, IReplStore::FindFirstItemsets *pfExistto TRUE.

  4. The service manager calls IReplStore::FindNextItemrepeatedly until *pfExistis FALSE, which indicates there are no more objects to be enumerated.

  5. The service manager calls IReplStore::FindItemCloseto free any resources that were used during enumeration.

The following code example shows how to implement IReplStore::FindFirstItem.

Copy Code
STDMETHODIMP CStore::FindFirstItem
   HREPLFLD hFolder,   // Handle to a folder
   HREPLITEM *phItem,   // Output pointer to the handle of the
				 // item in the folder
   BOOL *pfExist	// Output pointer to a Boolean value that is
				 // to TRUE if there is an object in the folder
   CFolder *pFolder = (CFolder*)hFolder;

   // Find the first item.
   // pItem in the following code points to the first item.
   // ...
   // Implementation retrieves the unique identifier from the first
   // pItem->m_uid		= retrieved_unique_ID;

   // Implementation retrieves whatever it uses to verify the first
   // has changed; for example, a time stamp.
   // pItem->m_ftModified = retrieved_time_stamp;

   *phItem = (HREPLITEM)pItem;

   if (pfExist)
	*pfExist = TRUE;

   return NOERROR;

During enumeration, you can select just those objects you want to synchronize by having the desktop provider return to the service manager only those that meet your criteria. For example, you might want to synchronize only appointments that fall within the next three days. The service manager accesses the selection criteria — which are stored with the folder handle — by calling IReplStore::IsItemReplicated.

Any object not returned by the enumeration appears as a deleted desktop object. The service manager assumes the object has been deleted and deletes the corresponding device object. To avoid deleting objects that do not meet the selection criteria, be sure the desktop provider's enumeration returns every object in the store whether or not the object meets the selection criteria.

You can reselect as conditions change. For example, you might want to synchronize appointments falling within the next three days, every day. In order to determine the date range to select for, the service manager calls IReplStore::ReportStatuswith RSC_DATE_CHANGED to initiate the synchronization process.

See Also