SharePoint 2010 set ‘Start this workflow to approve publishing a major version of an item’ with Powershell

Took me a little while to figure this one out, you’ve assigned your workflow to a library and you can set all other other flags like “AllowStartChange” and “AllowStartCreate”, but cant see how to set “Start this workflow to approve publishing a major version of an item.”

That’s because its a property on the library itself called “DefaultContentApprovalWorkflowId”

 

So you might want to do something like this…where you have the WorkFlow Association object ($wfAssociation) and the list/library ($list).

$wfAssociation = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]
::CreateListAssociation(……
$list.WorkflowAssociations.Add($wfAssociation) | Out-Null
$list.DefaultContentApprovalWorkflowId = $wfAssociation.Id
$list.Update()

Resources:

This is probably the best Associate workflow to list/library with Powershell example out there http://bit.ly/AcOa2s

Print | posted on Tuesday, March 6, 2012 11:52 AM

Feedback

No comments posted yet.

Your comment:





 
 

Copyright © Steve Clements

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski