我有一个事件接收器,将在SPList中的SPListItem更新时触发。我正在使用ItemUpdated()事件。SPListItem在事件之前和之后的值如何?
我想从事件之前获取值,以便我可以比较哪些已编辑的字段。
我该怎么做?
if (properties.ListTitle == "Lista")
{
if (properties.AfterProperties["Start Time"].ToString() != properties.ListItem["Start Time"].ToString())
{
string s = "hej";
}
}
try
{
// ID for the site from the properties object
Guid siteId = properties.SiteId;
// ID for the list from the properties object
Guid listId = properties.ListId;
// ID for the list item from the properties object
int listItemId = properties.ListItemId;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
// Code stuff
});
我尝试过,但我得到“对象引用未设置为对象的实例。” – carruw 2012-04-24 09:37:25
你试过的是什么?你可以在问题中更新你的代码吗? – Ishan 2012-04-24 09:38:32
更新了代码。 – carruw 2012-04-24 09:55:42