从回收站恢复项目时会触发什么事件
当项目从回收站恢复到共享点列表时会触发什么事件。以及如何使用属性找到该项目?请帮助我
what event is fired when an item is restored from recycle bin into a sharepoint list. And how to find that item using properties? please help me in this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
根据事件接收者内容类型:
...
也许您可以使用“已创建”字段的值来确定列表项是否确实是新的,或者是否正在从回收站中恢复。
According to Event Receivers on Content Types:
...
Maybe you can use the value of the Created field to determine if the list item is truly new or if it's being restored from the recycle bin.
当您从回收站恢复项目时,将触发 ItemAdded 事件。 此答案提供了一些有关如何区分项目是新添加还是恢复的选项。
ItemAdded Event is fired when you restore an item from Recycle bin. This Answer provides few option on how you could differentiate between if the items is newly added or restored.
我对此的解决方案:
My solution to this:
我今天遇到了同样的问题,但我的事件接收器位于 ItemAdding 中,其中 SPItemEventProperties 不包含任何日期。
我认为正确的方法是检查 SPItemEventProperties.ListItemId 属性。如果它是0,那么它是一个新项目。如果它不为 0,则它是从回收站恢复的项目,因为它必须在返回的列表中保留其原始 ID。
I faced the same issue today, but my event receiver was in ItemAdding where the SPItemEventProperties does not contain any date.
I think the right way of doing this is to check the value of the SPItemEventProperties.ListItemId property. If it is 0, then it is a new item. If it is not 0, then it is an item that is restored from the Recycle Bin as it has to keep it's original ID in the list it returns to.