本文介绍了Sharepoint远程事件接收器更改项目的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在列表/库的远程事件接收器中是否有可用的属性,我们可以在更新时检查哪个字段已更改?
In Remote event receiver for the list/library is there any property available where we can check which field has changed for Item while updating?
我尝试了 properties.ItemEventProperties.AfterProperties,但它获取了所有字段而不是仅更改字段
问候,
Prerak Desai
。
推荐答案
Hi Prerak,
Hi Prerak,
要确定SharePoint Remote Event Receiver中哪个字段已更改,它是必须将更新的字段值与 ItemUpdating 事件接收器中的原始值进行比较:
To figure out which field has changed in SharePoint Remote Event Receiver, it is necessary to compare the updated field value with the original value in ItemUpdating event receiver:
Uri myurl = new Uri(properties.ItemEventProperties.WebUrl); using (ClientContext clientContext = new ClientContext(myurl)) { if (clientContext != null) { List lstContacts = clientContext.Web.Lists.GetByTitle( properties.ItemEventProperties.ListTitle ); clientContext.Load(lstContacts); clientContext.ExecuteQuery(); int cnt = lstContacts.ItemCount; ListItem item = lstContacts.GetItemById(cnt); clientContext.Load(item); clientContext.ExecuteQuery(); var oldTitle = item["Title"].ToString(); var newTitle = properties.ItemEventProperties.AfterProperties["Title"].ToString(); if (oldTitle != newTitle) { //The title field has been changed } }这是一个类似的线程供您参考:
Here is a similiar thread for your reference:
通过RER中的CSOM获取ItemUpdated事件中的属性
谢谢
最好的问候
更多推荐
Sharepoint远程事件接收器更改项目的字段
发布评论