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

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

问题描述

我使用ItemAdding事​​件对我SPLists之一。现在的问题是如何,我可以从SPItemEventProperties获得新的尚未添加的项目?我试着ListItem.Item但debuger显示属性设置为Nothing。任何修正建议?

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?

最好的问候

T.S。

推荐答案

IHE <一href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spitemeventreceiver.itemadding.aspx"相对=nofollow> ItemAdding事​​件之前>一则条记录实际添加,所以你不能使用.Item访问的字段。

Ihe ItemAdding event fires before a recored is actually added so you can't access the fields using .Item.

不过你可以从ID访问一切的除了(因为它仍然没有被创建)的<一个href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spitemeventproperties.afterproperties.aspx"相对=nofollow>。AfterProperties 的哈希表。

However you can access everything apart from ID (as its still not been created yet) in the .AfterProperties hash table.

尼斯code样品

  • <一个href="http://dishashah.word$p$pss.com/2009/06/23/synchronous-event-hanlders-in-sharepoint-with-itemadding-and-itemupdating/"相对=nofollow>如何访问列表项的字段ItemAdding和ItemUpdating事件处理程序到SharePoint

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

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