Wednesday, February 11, 2009

SharePoint Content Approval Status updating programmatically

SharePoint document libraries and list comes with the option to enable content approval. Using this out of the box option users who can view draft list items and documents can be controled easily. When enabling this option in document library and list internally a column is created. However this column cannot be accessed in the Customize settings page. For those who needs to update this field programmatically you can do so by using the example provided below:

SPModerationInformation ApprovalStatus = item.ModerationInformation;

ApprovalStatus.Status = SPModerationStatusType.Approved;

item.Update();



There are 5 options which you can choose from.