IProviderSyncServices::CreateForgottenKnowledge

Creates an empty IForgottenKnowledge object that belongs to a replica.

HRESULT CreateForgottenKnowledge( 
  IReplicaKeyMap *pReplicaKeyMap,
  IForgottenKnowledge **ppKnowledge);

Parameters

  • pReplicaKeyMap
    [in] The replica key map that is used to initialize the newly created forgotten knowledge object.
  • ppKnowledge
    [out] Returns the newly created forgotten 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