开发者

Sharepoint Attachment Delete File Name

开发者 https://www.devze.com 2022-12-24 05:46 出处:网络
how to find the attachment filename which is getting deleted both Ite开发者_StackOverflow社区mAttachmentDeleted, ItemAttachmentDeleting events afterproperties and beforeproperties are emptyuse

how to find the attachment filename which is getting deleted

both Ite开发者_StackOverflow社区mAttachmentDeleted, ItemAttachmentDeleting events afterproperties and beforeproperties are empty


use

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


below code gives us first attachment Name

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

string link =  attachment.Name ;
0

精彩评论

暂无评论...
验证码 换一张
取 消