How to get deleted file when itemDeleted event fire in remote event receiver
-
08-02-2021 - |
문제
How to get the deleted file when itemDeleted
event fire in remote event receiver in SharePoint Online.
I have tried as follows but this does not work:
List photos = clientContext.Web.Lists.GetById(properties.ItemEventProperties.ListId);
ListItem item = photos.GetItemById(properties.ItemEventProperties.ListItemId);
string filename = Convert.ToString(item["FileLeafRef"]);
해결책
Use ItemDeleting event instead of ItemDeleted if you want to get the file which is to be deleted. For ItemDeleted event List Item properties are not available.
다른 팁
ItemDeleted Event will trigger after the file has been deleted, if you want to get file which will be deleted, use ItemDeleting instead:
SharePoint Remote Event Receiver – Item Deleting – Using Provider hosted App
You can get deleted item as follows.
var fileurl = properties.ItemEventProperties.BeforeUrl;
string[] nFileName = fileurl.Split('/');
var fileName = nFileName[1];
제휴하지 않습니다 sharepoint.stackexchange