Quantcast
Viewing all articles
Browse latest Browse all 49

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

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 49

Trending Articles