IProvQueue::SubmitTrustedRequest


Submits a trusted request to the Provisioning Queue Manager Service of Microsoft. Provisioning Framework (MPF) to execute one or more procedures using the request XML from a trusted user credential. 

SubmitTrustedRequest includes an option to submit a suspended request. By default, only members of the groups Administrators, MPFAdmins, and MPFTrustedUsers are allowed to call this method.

Syntax

C++
HRESULT SubmitTrustedRequest  (
	BSTR bstrRequest,
	BOOL fSuspended,
	BSTR *bstrQueueID
);
Visual Basic
Function SubmitTrustedRequest ( _
	bstrRequest As String, _
	fSuspended As Boolean  _
) As String

Parameters

bstrRequest
XML data node for the request.
fSuspended
Specifies whether the request is submitted as suspended. If set to 1 (true), the queue manager will not execute the request until you unsuspend it with a call to Activate. Before you can add a child request to a parent request with AddDependency, you must suspend both requests.
bstrQueueID (C++) / return value (VB)
Queue ID returned for the submitted request. The queue ID can be used by Activate, AddDependencyDelete, QueryResults, and QueryStatus.

Return Codes

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

Performance Counters

Counter Object: Microsoft Provisioning Client
Counter Instance: Trusted Queued Requests

Average Request Latency Average time for this client to execute a provisioning request. Each call to SubmitTrustedRequest contributes to the average latency of up to the last 100 requests.
Request Rate Incoming request rate for this client. Each call to SubmitTrustedRequest contributes to the average request rate of transactions per second.
Requests Executing Number of concurrently executing requests at this client. Identifies the total number of concurrent calls to SubmitTrustedRequest.
Total Requests Number of requests this client has processed. Each call to SubmitTrustedRequest increments this counter.
Total Requests Failed Total number of failed requests that this client initiated. Each call to SubmitTrustedRequest that returns a failed HRESULT increments this counter.

C++ Example

LPCWSTR wszRequest = L"<request>\n" + 
					 L"  <data>\n" +
					 L"	<organizations>\n" +
					 L"	<organization name=\"tailspintoys.com\"/>\n" +
					 L"	</organizations>\n" +
					 L"  </data>\n" +
					 L"  <context>\n" +
					 L"	<clientContext clientTransactionId=\"53367B03-63D3-44ae-B8AD-C1E57E876E6C\"/>\n" +
					 L"  </context>\n" +
					 L"  <procedure>\n" +
					 L"	<execute namespace=\"Test Namespace\" procedure=\"Write Request\">\n" +
					 L"	<forEach name=\"organization\" root=\"data\"\n"  +
					 L"			 path=\"organizations/organization\"/>\n" +
					 L"	<before source=\"organization\" destination=\"executeData\"/>\n" +
					 L"	</execute>" +
					 L"  </procedure>" +
					 L"</request>";

IProvQueue * pProvQueue = NULL;
BSTR bstrRequest = ::SysAllocString(wszRequest);
BSTR bstrQueueID = NULL;
HRESULT hr = E_OUTOFMEMORY;

if(bstrRequest)
{
	// Create queue manager client:
	hr = CoCreateInstance(CLSID_ProvQueueClient, NULL, CLSCTX_ALL, IID_IProvQueue, (void**)(&pProvQueue));
	if(hr == S_OK)
	{
		hr = pProvQueue->SubmitTrustedRequest(bstrRequest, FALSE, &bstrQueueID);
		pProvQueue->Release();
}
}

// Get the error description in the case of error
if(FAILED(hr))
{
	IErrorInfo* pErrInfo = NULL;
	if(::GetErrorInfo(0, &pErrInfo) == S_OK && pErrInfo)
	{
		pErrInfo->GetDescription(&bstrQueueID);
		pErrInfo->Release();
}
}

// Show the results
MessageBoxW(NULL, bstrQueueID ? bstrQueueID : L"Unknown error occured", L"Queued request results", MB_OK);

// Clean up
::SysFreeString(bstrRequest);
::SysFreeString(bstrQueueID);

Visual Basic Example

Dim objProvQueue
Dim strRequest
Dim strQueueID

On Error Resume Next

' Request:
strRequest = ""
strRequest = strRequest & "<request>"
strRequest = strRequest & "  <data>"
strRequest = strRequest & "	<organizations>"
strRequest = strRequest & "	<organization name=""tailspintoys.com""/>"
strRequest = strRequest & "	</organizations>"
strRequest = strRequest & "  </data>"
strRequest = strRequest & "  <context>"
strRequest = strRequest & "	<clientContext clientTransactionId=""53367B03-63D3-44ae-B8AD-C1E57E876E6C""/>"
strRequest = strRequest & "  </context>"
strRequest = strRequest & "  <procedure>"
strRequest = strRequest & "	<execute namespace=""Test Namespace"" procedure=""Write Request"">"
strRequest = strRequest & "	<forEach name=""organization"" root=""data"" path=""organizations/organization""/>"
strRequest = strRequest & "	<before source=""organization"" destination=""executeData""/>"
strRequest = strRequest & "	</execute>"
strRequest = strRequest & "  </procedure>"
strRequest = strRequest & "</request>"

' Create queue manager client:
Set objProvQueue = CreateObject("Provisioning.ProvQueue.1")
If Err.Number = 0 Then
	strQueueID = objProvQueue.SubmitTrustedRequest(strRequest,  False)
	If Err.Number = 0 Then
		MsgBox "Queue ID: " & strQueueID
	Else
		MsgBox Err.Description
	End If
End If

See Also

Authorization During Request Submittal, IProvQueue, Security Contexts, SubmitRequest, XML Schema for Requests


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