Udostępnij za pośrednictwem


IProviderSyncServices::CreateSyncKnowledge

Creates an empty ISyncKnowledge object that belongs to a specified replica.

HRESULT CreateSyncKnowledge( 
  ULONGLONG ullCurrentTickCount,
  IReplicaKeyMap *pReplicaKeyMap,
  ISyncKnowledge **ppKnowledge);

Parameters

  • pullCurrentTickCount
    [in] The current tick count for the replica that owns the newly created knowledge object.
  • pReplicaKeyMap
    [in] The replica key map that will be contained by the newly created knowledge object.
  • ppKnowledge
    [out] Returns the newly created knowledge object.

Return Value

  • S_OK

  • E_OUTOFMEMORY

  • E_POINTER

  • SYNC_E_INVALID_OPERATION when this object is not initialized.

Example

The following example uses IProviderSyncServices to create several objects. The example stores the objects for later use.

IProviderSyncServices* pProvSvc;
hr = GetProviderSyncServices(&c_idParams, &pProvSvc);
if (SUCCEEDED(hr))
{
    IReplicaKeyMap* pReplicaKeyMap = NULL;
    hr = pProvSvc->CreateReplicaKeyMap((BYTE*)&guidReplicaID, &pReplicaKeyMap);
    if (SUCCEEDED(hr))
    {
        hr = SetReplicaKeyMap(pReplicaKeyMap);
        if (SUCCEEDED(hr))
        {
            ISyncKnowledge* pKnowledge = NULL;
            hr = pProvSvc->CreateSyncKnowledge(0, pReplicaKeyMap, &pKnowledge);
            if (SUCCEEDED(hr))
            {
                hr = SetKnowledge(pKnowledge);
                if (SUCCEEDED(hr))
                {
                    IForgottenKnowledge* pForgottenKnowledge = NULL;
                    hr = pProvSvc->CreateForgottenKnowledge(pReplicaKeyMap, &pForgottenKnowledge);
                    if (SUCCEEDED(hr))
                    {
                        hr = SetForgottenKnowledge(pForgottenKnowledge);

                        pForgottenKnowledge->Release();
                    }
                }

                pKnowledge->Release();
            }
        }

        pReplicaKeyMap->Release();
    }
    pProvSvc->Release();
}

See Also

Reference

IProviderSyncServices Interface