This method returns a new handle to the first object in a specified folder, if there is any.
At a Glance
Header file: | Cesync.h |
Windows CE versions: | 2.0 and later |
Syntax
HRESULT FindFirstItem( HREPLFLD hFolder, HREPLITEM *phItem,
BOOL * pfExist );
Parameters
hFolder
Handler to a folder.
phItem
[out] Pointer to a handle to the first object in the folder.
pfExist
[out] Pointer to a Boolean value that is set to TRUE if there is an object in the folder.
Return Values
One of the values described in the following table is returned.
Value | Description |
E_FAIL | There are problems with the enumeration. Replication should ignore the folder. |
NOERROR | A new HREPLITEM was created for the first object in the folder and its pointer has been returned. |
Remarks
The IReplStore::FindFirstItem method works together with FindNextItem and FindItemClose to enumerate all items in a specified folder. FindFirstItem and FindNextItem are the only methods in IReplStore that can create HREPLITEM for the items. All HREPLITEM structures passed by the ActiveSync service manager are guaranteed to be originally created from these two methods. It is possible that, before FindItemClose is called, a different thread calls methods like DeleteObject that write to the store. Therefore, it is important for the ActiveSync service provider to have some sort of thread synchronization between this method and the methods that write to the store. A typical ActiveSync service provider would use critical section to make sure that, during the time between calls to FindFirstItem and FindItemClose, no write to the store is permitted.
See Also
HREPLITEM, IReplStore::FindItemClose, IReplStore::FindNextItem