Sharepoint附件删除文件名

时间:2010-03-24 21:44:19

标签: sharepoint-2007

如何找到要删除的附件文件名

ItemAttachmentDeleted,ItemAttachmentDeleting事件afterproperties和beforeproperties为空

2 个答案:

答案 0 :(得分:1)

使用

 string beforeUrl = properties.BeforeUrl;
 string[] fileName = beforeUrl.Split('/');
 string deletedfile = fileName[fileName.Length - 1];

答案 1 :(得分:0)

下面的代码为我们提供了第一个附件名称

SPFile attachment = properties.ListItem.ParentList.RootFolder.
      SubFolders["Attachments"].SubFolders[properties.ListItemId.ToString()].
      Files[properties.ListItem.Attachments.Count - 1];    

string link =  attachment.Name ;