Important:
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
4/8/2010

This method returns a new handle to the first object in a specified folder, if there is any.

Syntax

HRESULT FindFirstItem(
  HREPLFLD 
hFolder,
  HREPLITEM* 
phItem,
  BOOL* 
pfExist
);

Parameters

hFolder

[in] 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 TRUE if there is an object in the folder.

Return Value

The following table describes the return values for this function.

Value Description

E_FAIL

There are problems with the enumeration. Replication should ignore the folder.

NOERROR

A new HREPLITEMwas created for the first object in the folder and its pointer has been returned.

Remarks

FindFirstItemworks with FindNextItemand FindItemCloseto enumerate all items in a specified folder. FindFirstItemand FindNextItemare the only methods in IReplStorethat can create HREPLITEMfor the items. All HREPLITEMstructures passed by the ActiveSync manager are guaranteed to be originally created from these two methods.

It is possible that, before FindItemCloseis called, a different thread calls methods like DeleteObjectthat write to the store. Therefore, it is important for the ActiveSync service provider to have 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 FindFirstItemand FindItemClose, no write to the store is permitted.

Requirements

Header cesync.h
Library coredll.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also