This project is read-only.
This sample creates a Workflow in FIM (known to FIM as a WorkflowDefinition). The trickiest part of the WorkflowDefinition is the XOML property because it is usually large, and usually contains references to other objects.

Note the use of the Here-String in the sample below, along with the use of the -F operator (similar to String.Replace in .NET) to subsitute a reference into the XOML string.

###
### Create the Workflow: 'Congratulate New Craigs'
###
$xoml = @"
<ns0:SequentialWorkflow 
  x:Name                ="SequentialWorkflow" 
  ActorId               ="00000000-0000-0000-0000-000000000000" 
  WorkflowDefinitionId  ="00000000-0000-0000-0000-000000000000" 
  RequestId             ="00000000-0000-0000-0000-000000000000" 
  TargetId              ="00000000-0000-0000-0000-000000000000" 
  xmlns                 ="http://schemas.microsoft.com/winfx/2006/xaml/workflow" 
  xmlns:x               ="http://schemas.microsoft.com/winfx/2006/xaml" 
  xmlns:ns0             ="clr-namespace:Microsoft.ResourceManagement.Workflow.Activities;
                          Assembly=Microsoft.ResourceManagement, 
                          Version=4.1.1906.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
  <ns0:EmailNotificationActivity 
    x:Name              ="authenticationGateActivity1" 
    EmailTemplate       ="{0}" 
    To                  ="[//Target];" 
    CC                  = "{{x:Null}}" 
    Bcc                 = "{{x:Null}}" 
    SuppressException   ="False" />
</ns0:SequentialWorkflow>
"@ -F (Get-FimObjectID EmailTemplate DisplayName "Template for Craig")

New-FimImportObject -objectType WorkflowDefinition -State Create -Changes @{
	DisplayName 		= 'Congratulate New Craigs'
	Description        	= 'Because Membership Matters'
	RequestPhase 	   	= 'Action'
	RunOnPolicyUpdate	= 'False'
	XOML = $xoml
} -ApplyNow  

Last edited Aug 14, 2012 at 7:32 PM by CraigMartin, version 1

Comments

No comments yet.