Provisioning Schema::forEach

Element that encapsulates a processing loop for a provisioning procedure. Specifies the data source for the loop and how to handle errors. This element is part of the provisioning schema of Microsoft. Provisioning Framework (MPF).


execute, queue, transform


Optional. Enumeration that specifies how the forEach loop reacts if the node specified by the attributes root and path is not present.
  • "fail" (default): Returns a failure.
  • "skip": Skips execution for the current iteration of the loop.
  • "ignore": Treats the incoming node as optional and continues executing the procedure.
Required. Name of the forEach node. The forEach node names must be unique within an execute element.
Optional. XPath offset from the element specified by the root attribute. If path is not specified, the forEach loop starts from the root node.
Required. Starting element for the forEach iteration. 
  • "data" (the request's data node)
  • "procedureData" (for the current procedure step)
  • Name of a previous forEach node


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.

		<organization name="" type="primary" >
			<user name="joe"/>
			<user name="nancy"/>
		<organization name="" type="primary">
			<user name="fred"/>
		<organization name="" type="secondary">
		<organization name="" type="secondary">
	<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']">
			<xsl:value-of select="@name"/>
		<xsl:template match="organization[@type='secondary']">
			<xsl:value-of select="@name"/>
	<after source="executeData" destination="data" destinationPath="orgSignup" mode="merge"/>

See also

Customization, Procedure Examples, XML Schema for Procedures

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