我是 Sharepoint 的新手。我有一个连接到 ItemUpdated 事件的 EventReceiver,我想在一个字段中写一个文本。当我上传文件时,事件触发正常,它通过调试代码,似乎更新但我的属性没有收到它应该接收的文本。但是,在页面上点击刷新后,我可以看到更新的值。
这是我的代码
public override void ItemUpdated(SPItemEventProperties properties)
{
base.ItemUpdated(properties);
string folderPath = string.Empty;
SPListItem item = properties.ListItem;
if (item.File.ParentFolder != null)
{
folderPath = item.File.ParentFolder.ServerRelativeUrl;
}
AssignPropertyToField("Folder Name", item, folderPath);
}
private void AssignPropertyToField(string fieldName, SPListItem item, string folderPath)
{
item[fieldName] = folderPath;
this.EventFiringEnabled = false;
item.SystemUpdate();
this.EventFiringEnabled = true;
}
提前感谢您的建议,
问候,