如何从事件处理程序中的SPItemEventProperties中获取当前添加项目到SPList?

编程入门 行业动态 更新时间:2024-10-27 18:24:53
本文介绍了如何从事件处理程序中的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?

本文发布于:2023-11-11 13:40:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1578603.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:事件   程序   项目   SPItemEventProperties   SPList

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!