如何从事件处理程序中的SPItemEventProperties中获取当前添加项目到SPList? [英] How to get currently adding item to SPList from SPItemEventProperties inside event handler?

查看:206
本文介绍了如何从事件处理程序中的SPItemEventProperties中获取当前添加项目到SPList?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的一个SPLists使用ItemAdding事件。问题是如何从SPItemEventProperties获取新的尚未添加的项目?我尝试过ListItem.Item,但调试器显示该属性设置为Nothing。任何纠正建议?



最好的问候



TS

解决方案

Ihe ItemAdding事件在之前激活,实际添加了一个记录,因此您无法使用.Item访问字段。



但是可以在。AfterProperties 哈希表。



尼斯代码示例




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

这篇关于如何从事件处理程序中的SPItemEventProperties中获取当前添加项目到SPList?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆