Sunday, November 29, 2009

Write custom workflow for content approval

In order to write custom workflow for content approval you may need to do a lot depending on your requirements but following are few useful tips that may help you to to it quickly

1. How to approve list item from your code

In order to approve list item from your code you need to need to modify list item's moderation status using following line
Item.ModerationInformation.Status = SPModerationStatusType.Approved
Where Item is your list item

2. In order to start workflow automatically on item publishing event
You need to select following option while associating custom workflow with your list
"Start this workflow to approve publishing a major version of an item"
You may not find this option with your custom work flow if you haven't placed following configuration in your wokflow meta data while defining work flow.

<Workflow .... .> .......... <MetaData> <InitiationType>
Manual;#OnNewItem;#OnItemUpdate;#OnMajorCheckIn

</
InitiationType> </MetaData> </Workflow>

No comments:

Post a Comment