IProvQueue::QueryStatus


Retrieves the current status of a queued request. Used to query requests managed by the Provisioning Queue Manager Service of Microsoft. Provisioning Framework (MPF).

Syntax

C++
HRESULT QueryStatus  (
	BSTR bstrQueueID,
	VARIANT *status
);
Visual Basic
Function QueryStatus ( _
	bstrQueueID As String _
) As Variant

Parameters

bstrQueueID
Queue ID of the query request. Returned by SubmitRequest or SubmitTrustedRequest.
status (C++) / return value (VB)
One of the following return values.
 
Name Value Description
QUEUE_SUCCESS 0 The queue has completed successfully.
QUEUE_ERROR 1 The queue has completed with errors.
QUEUE_FAILURE 2 The queue has completed with failures.
QUEUE_ERROR_AND_FAILURE 3 The queue has completed with errors and failures.
QUEUE_PENDING 4 The queue is pending to be processed.
QUEUE_STARTED 5 The queue is being processed.
QUEUE_QUEUED_FOR_RETRY 10 The queue is being retried.
QUEUE_WITH_INCOMPLETE_PREREQ 11 The queue has parent queues that have not completed yet.
QUEUE_WITH_COMPLETE_PREREQ 12 The queue's parent queues have just completed. The queue is pending.
QUEUE_SUSPENDED 13 The queue is suspended.
QUEUE_SUSPENDED_WITH_WAITS 14 The queue is suspended and has parent queues that have not completed yet.
QUEUE_FAILED_AWAITING_OPERATOR 15 The queued request has failed all retry attempts and is now waiting for the operator to fail or retry.

Return Codes

Zero indicates success; a non-zero value represents an error. For a list of error codes, see MPF Errors.

C++ Example

IProvQueue *pProvQueue = NULL;
BSTR bstrRequest = NULL;
BSTR bstrQueueID = NULL;
VARIANT vStatus;
HRESULT hr = E_OUTOFMEMORY;

LPCWSTR wszStatus[] = {
	L"The queue has completed successfully.",
	L"The queue has completed with errors.",
	L"The queue has completed with failures.",
	L"The queue has completed with errors and failures.",
	L"The queue is pending to be processed.",
	L"The queue is being processed.",
	L"The queue is being retried.",
	L"The queue has parent queues that have not completed yet.",
	L"The queue's parent queues have just completed. The queue is pending.",
	L"The queue is suspended.",
	L"The queue is suspended and has parent queues that have not completed yet.",
	L"The queued request has failed all retry attempts and is now waiting for the " + 
		L"operator to fail or retry.",
	L"Unknown status code.",
};

// The code for creating the queue manager client and the request string was skipped
...

// Create a queued request
hr = pProvQueue->SubmitTrustedRequest(bstrRequest, FALSE, &bstrQueueID);
if(FAILED(hr)) goto LocalCleanup;

// Do something
...

// Check the current status
hr = pProvQueue->QueryStatus(bstrQueueID, &vStatus);
if(FAILED(hr)) goto LocalCleanup;

if(SUCCEEDED(::VariantChangeType(&vStatus, &vStatus, 0, VT_I4)))
{
	if(vStatus.lVal < 0 || vStatus.lVal >= (sizeof(wszStatus) / sizeof(*wszStatus)))
		vStatus.lVal = sizeof(wszStatus) / sizeof(*wszStatus)  1;
	MessageBoxW(NULL, wszStatus[vStatus.lVal], L"Current queued request status ", MB_OK);
}
::VariantClear(&vStatus);

// Clean up
LocalCleanup:
	if(pProvQueue)
		pProvQueue->Release();
	::SysFreeString(bstrRequest);
	::SysFreeString(bstrQueueID);

Visual Basic Example

Dim objProvQueue
Dim strRequest
Dim strQueueID
Dim status

Const QUEUE_SUCCESS				= 0
Const QUEUE_ERROR					= 1
Const QUEUE_FAILURE				= 2
Const QUEUE_ERROR_AND_FAILURE		= 3
Const QUEUE_PENDING				= 4
Const QUEUE_STARTED				= 5
Const QUEUE_QUEUED_FOR_RETRY		 = 10
Const QUEUE_WITH_INCOMPLETE_PREREQ   = 11
Const QUEUE_WITH_COMPLETE_PREREQ	 = 12
Const QUEUE_SUSPENDED				= 13
Const QUEUE_SUSPENDED_WITH_WAITS	 = 14
Const QUEUE_FAILED_AWAITING_OPERATOR = 15

Dim StatusMsgArray(16)
StatusMsgArray( 0) = "The queue has completed successfully."
StatusMsgArray( 1) = "The queue has completed with errors."
StatusMsgArray( 2) = "The queue has completed with failures."
StatusMsgArray( 3) = "The queue has completed with errors and failures."
StatusMsgArray( 4) = "The queue is pending to be processed."
StatusMsgArray( 5) = "The queue is being processed."
StatusMsgArray(10) = "The queue is being retried."
StatusMsgArray(11) = "The queue has parent queues that have not completed yet."
StatusMsgArray(12) = "The queue's parent queues have just completed. The queue is pending."
StatusMsgArray(13) = "The queue is suspended."
StatusMsgArray(14) = "The queue is suspended and has parent queues that have not completed yet."
StatusMsgArray(15) = "The queued request has failed all retry attempts and is now waiting for the "
StatusMsgArray(15) = StatusMsgArray(15) & " operator to fail or retry."
StatusMsgArray(16) = "Unknown status code."

' The code for creating the queue manager client and the request string was skipped
...

' Create a queued request
strQueueID = objProvQueue.SubmitTrustedRequest(strRequest, False)

' Do something
...

' Check the current status
status = objProvQueue.QueryStatus(strQueueID)
If status < QUEUE_SUCCESS Or status > QUEUE_FAILED_AWAITING_OPERATOR Then
	status = QUEUE_FAILED_AWAITING_OPERATOR + 1
End If
MsgBox StatusMsgArray(status)

See Also

IProvQueue, QueryResults


Up Top of Page
) 1999-2002 Microsoft Corporation. All rights reserved.