Provisioning Schema::forEach
Element that encapsulates a processing loop for a provisioning procedure. Specifies the data source for the loop and how to Error Handling. This element is part of the provisioning schema of Microsoft Provisioning Framework (MPF).
Arguments
Input Argument | Description |
---|---|
ifNull |
Optional. Enumeration that specifies how the forEach loop reacts if the node specified by the attributes root and path is not present.
|
name |
Required. Name of the forEach node. The forEach node names must be unique within an execute element. |
path |
Optional. XPath offset from the element specified by the root attribute. If path is not specified, the forEach loop starts from the root node. |
root |
Required. Starting element for the forEach iteration.
|
Remarks
No remarks.
Sample Code
Example XML Request
In the following example, MPF calls the Write Request procedure for each organization and user in the data node. The ifNull="skip" attribute in the forEach node for name="user" instructs MPF to skip execution for the current iteration rather than fail the entire request whenever an organization does not have a user.
<request>
<data>
<organizations>
<organization name="tailspintoys.com" type="primary" >
<user name="joe"/>
<user name="nancy"/>
</organization>
<organization name="wideworldimporters.com" type="primary">
<user name="fred"/>
</organization>
<organization name="fourthcoffee.com" type="secondary">
</organization>
<organization name="adventure-works.com" type="secondary">
</organization>
</organizations>
</data>
<procedure>
<execute namespace="Test Namespace" procedure="Write Request">
<forEach name="organization" root="data" path="organizations/organization"/>
<forEach name="user" root="organization" path="user" ifNull="skip"/>
<before source="organization" destination="executeData">
<xsl:template match="organization[@type='primary']">
<primaryOrg>
<xsl:value-of select="@name"/>
</primaryOrg>
</xsl:template>
<xsl:template match="organization[@type='secondary']">
<secondaryOrg>
<xsl:value-of select="@name"/>
</secondaryOrg>
</xsl:template>
</before>
<after source="executeData" destination="data" destinationPath="orgSignup" mode="merge"/>
</execute>
</procedure>
</request>
Applies To
Provisioning Schema; Provisioning Schema::execute; Provisioning Schema::queue; Provisioning Schema::transform
See also
Tasks
Provisioning Schema::execute
Provisioning Schema::queue
Provisioning Schema::transform
Provisioning Schema::data