SharePoint - checking Content Approval change status in event receiver

浪尽此生 提交于 2019-12-25 01:53:34

问题


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:


Would this help?

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




回答2:


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

It works for me




回答3:


Please refer to the following properties in the AfterProperties section for a document library.

Document libraries are a bit different than lists. the doc libraries have .AfterProperties["vti_doclibmodstat"] and .AfterProperties["vti_doclibmodcomm"].



来源:https://stackoverflow.com/questions/1562126/sharepoint-checking-content-approval-change-status-in-event-receiver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!