IProviderSyncServices::CreateForgottenKnowledge

创建属于副本的空 IForgottenKnowledge 对象。

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

参数

  • pReplicaKeyMap
    [in] 用于初始化新创建的遗忘知识对象的副本键映射。
  • ppKnowledge
    [out] 返回新创建的遗忘知识对象。

返回值

  • S_OK

  • E_OUTOFMEMORY

  • E_POINTER

  • 如果未初始化此对象,则返回值为 SYNC_E_INVALID_OPERATION。

示例

以下示例使用 IProviderSyncServices 创建多个对象。此示例存储这些对象供以后使用。

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();
}

请参阅

参考

IProviderSyncServices 接口