Gets the global ID of the item.


HRESULT GetGlobalId(
  BYTE * pbGlobalId,
  ULONG * pcbGlobalId);


  • pbGlobalId
    [in, out, size_is(*pcbGlobalId), unique] Returns the global ID of the item.

  • pcbGlobalId
    [in, out] Specifies the number of bytes in pbGlobalId. Returns the number of bytes required to retrieve the global ID when pbGlobalId is too small; otherwise, returns the number of bytes written.

Return Value

  • S_OK.

  • S_FALSE if the global ID has not been set.


  • HRESULT_FROM_WIN32(ERROR_MORE_DATA) when pbGlobalId is not large enough to receive the field value. In this case, pcbGlobalId returns the required number of bytes.


The global ID uniquely identifies the item throughout the synchronization scope.

The format of the ID returned depends on the ID format schema specified when the replica was initialized. For information about ID formats, see Metadata Requirements for Standard Providers.

If IItemMetadata::SetGlobalId was called to set the global ID value, but the change has not yet been saved by a call to IReplicaMetadata::SaveItemMetadata, GetGlobalId returns the value that is contained in the IItemMetadata object and not the value that is stored in the metadata store.

See Also


IItemMetadata Interface