views:

993

answers:

2

I have a SharePoint list with Content Approval enabled. The business requirement is that once the new list item is approved it should stay approved despite further updates by any user.

My first thought was to handle the ItemUpdating method, and if the corresponding before property is Approved then set the after property to Approved. This doesn't work however.

In the ItemUpdating method the "Approval Status" column does not show up in properties.BeforeProperties or properties.AfterProperties. properties.ListItem["Approval Status"] and properties.ListItem.ModerationInformation.Status both show the "before" value. In the ItemUpdated method the situation is the same, except instead the values shown are the "after" values.

Is there a way in either method to identify both the before and after methods? I can work around this by creating a new hidden column that I set when the item is approved but that doesn't seem best.

Should I be approaching this from a workflow perspective?

+1  A: 

Would this help?

http://www.synergyonline.com/blog/blog-moss/Lists/Posts/Post.aspx?ID=25

unfortunately "Approval Status"/"_ModerationStatus doesn't appear in the BeforeProperties or AfterProperties collections.
Chloraphil
_ModerationStatus *does* appear in the AfterProperties collection (when it is changed, of couse). Not sure how I missed it before.
Chloraphil
A: 

Use field's internal name with AfterProperties or BeforeProperties. i.e. properties.AfterProperties["internal name"].

It works for me

Hiral

related questions