1
votes

how to find the attachment filename which is getting deleted

both ItemAttachmentDeleted, ItemAttachmentDeleting events afterproperties and beforeproperties are empty

2

2 Answers

1
votes

use

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

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 ;