ILoadChangeContext::GetSyncChange
Gets the change item for which the change data should be retrieved from the item store.
Syntax
HRESULT GetSyncChange(
ISyncChange ** ppSyncChange);
Parameters
- ppSyncChange
[out] Returns the change item for which the change data should be retrieved from the item store.
Return Value
S_OK
E_POINTER
SYNC_E_INTERNAL_ERROR when an internal error occurs.
Example
The following example is an implementation of ISynchronousDataRetriever::LoadChangeData that uses GetSyncChange to get the specified change to load. The example finds the change in a custom data store and returns a copy of it.
STDMETHODIMP CItemStore::LoadChangeData(
ILoadChangeContext * pLoadChangeContext,
IUnknown ** ppUnkData)
{
HRESULT hr = E_UNEXPECTED;
if (NULL == pLoadChangeContext || NULL == ppUnkData)
{
hr = E_POINTER;
}
else
{
// Find the item in the data store, clone it, and return its IUnknown interface.
ISyncChange* pChange = NULL;
hr = pLoadChangeContext->GetSyncChange(&pChange);
if (SUCCEEDED(hr))
{
SYNC_GID gidItem;
DWORD cbID = sizeof(gidItem);
hr = pChange->GetRootItemId((BYTE*)&gidItem, &cbID);
if (SUCCEEDED(hr))
{
IXMLDOMNode* pNodeItem = NULL;
hr = FindItem(&gidItem, &pNodeItem);
if (SUCCEEDED(hr))
{
IXMLDOMNode* pNodeClone = NULL;
hr = pNodeItem->cloneNode(TRUE, &pNodeClone);
if (SUCCEEDED(hr))
{
hr = pNodeClone->QueryInterface(IID_IUnknown, (void**)ppUnkData);
pNodeClone->Release();
}
pNodeItem->Release();
}
}
pChange->Release();
}
}
return hr;
}