ICertRequest::RetrievePending 方法 (certcli.h)

RetrievePending 方法會從先前可能傳回CR_DISP_INCOMPLETE或CR_DISP_UNDER_SUBMISSION的要求擷取憑證的處置狀態。

如果產生的處置狀態CR_DISP_ISSUED,您可以呼叫 ICertRequest3::GetCertificate 來擷取已發行的憑證。 如果傳回CR_DISP_ISSUED以外的處置,請呼叫 ICertRequest3::GetLastStatusICertRequest3::GetDispositionMessage 或這兩種方法以取得詳細資訊。

語法

HRESULT RetrievePending(
  [in]          LONG       RequestId,
  [in]          const BSTR strConfig,
  [out, retval] LONG       *pDisposition
);

參數

[in] RequestId

先前傳回CR_DISP_INCOMPLETE或CR_DISP_UNDER_SUBMISSION的要求標識碼。

[in] strConfig

表示憑證服務伺服器的有效組態字串。 字串可以是註冊伺服器的 HTTPS URL,或窗體 ComputerName\CAName,其中 ComputerName 是伺服器的網路名稱,而 CAName證書頒發機構單位的一般名稱,如憑證服務設定期間所輸入。 如需設定字串名稱的相關信息,請參閱 ICertConfig

Windows Server 2008、Windows Vista、Windows Server 2003 和 Windows XP: 不支援 HTTPS URL 做為輸入。

[out, retval] pDisposition

要求處置值的指標。

傳回值

C++

如果方法成功,方法會傳回S_OK。

成功完成此函式時,*pDisposition 會設定為下表中的其中一個值。

如果方法失敗,它會傳回指出錯誤的 HRESULT 值。 如需常見錯誤碼的清單,請參閱 一般 HRESULT 值

VB

傳回值會指定要求的處置。 處置是下列其中一個值。
傳回碼 Description
CR_DISP_INCOMPLETE
要求未完成
CR_DISP_ERROR
要求失敗
CR_DISP_DENIED
要求遭拒
CR_DISP_ISSUED
已發出憑證
CR_DISP_ISSUED_OUT_OF_BAND
個別發行的憑證
CR_DISP_UNDER_SUBMISSION
提交下所採取的要求

備註

成功呼叫這個方法會產生EXITEVENT_CERTRETRIEVEPENDING事件。 如果呼叫 ICertExit3::Initialize 時,結束模組指定了此事件的結束模組,就會收到此事件的通知, (呼叫 ICertExit3::Notify) 。

範例

BSTR    bstrCA = NULL;
long    nReqID, nDisp;

// In this example, the request ID is hard-coded.
nReqID = 1234;

// Note use of two '\' in C++ to produce one '\'.
bstrCA = SysAllocString(L"server01\\myCAName");

// pCertRequest is previously instantiated ICertRequest
// object pointer. Retrieve the status for the specified request.
hr = pCertRequest->RetrievePending( nReqID, bstrCA, &nDisp );
if (FAILED(hr))
{
    printf("Failed RetrievePending [%x]\n", hr);
    goto error;
}
else
{
    // Use the disposition value as needed...
}
// Free BSTR resource.
if ( NULL != bstrCA )
    SysFreeString( bstrCA );

規格需求

需求
最低支援的用戶端 Windows XP [僅限傳統型應用程式]
最低支援的伺服器 Windows Server 2003 [僅限桌面應用程式]
目標平台 Windows
標頭 certcli.h (包含 Certsrv.h)
程式庫 Certidl.lib
Dll Certcli.dll

另請參閱

CCertRequest

ICertConfig

ICertRequest

ICertRequest2

ICertRequest3