本文介绍了如何从事件处理程序中的SPItemEventProperties中获取当前添加项目到SPList?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为我的一个SPLists使用ItemAdding事件。问题是如何从SPItemEventProperties获取新的尚未添加的项目?我尝试过ListItem.Item,但调试器显示该属性设置为Nothing。任何纠正建议?
最好的问候
TS
解决方案Ihe ItemAdding事件在之前激活,实际添加了一个记录,因此您无法使用.Item访问字段。
但是可以在。AfterProperties 哈希表。
尼斯代码示例
- 如何在ItemAdding和ItemUpdating事件处理程序中将列表项的字段访问到SharePoint
I'm using ItemAdding Event for one of my SPLists. The question is how I can get the new not yet added item from SPItemEventProperties? I've tried to ListItem.Item but the debuger shows that the property is set to Nothing. Any correction suggest?
Best Regards
T.S.
解决方案Ihe ItemAdding event fires before a recored is actually added so you can't access the fields using .Item.
However you can access everything apart from ID (as its still not been created yet) in the .AfterProperties hash table.
Nice code sample
- How to access fields of List Item in ItemAdding and ItemUpdating event handlers into SharePoint
更多推荐
如何从事件处理程序中的SPItemEventProperties中获取当前添加项目到SPList?
发布评论