Search code examples
sharepointoffice365sharepoint-onlineoffice365-apps

Can we create a remote event receiver to prevent users from deleting files but allow them to rename the files


We created a custom permission level which mimic the built-in Contribute permission level but without the ability to delete items and versions, by unchecking those 2 checkboxes:-

User's image

Our intention was to prevent users from moving folders and deleting folders, but currently users cannot rename files also. So does anyone face this issue? and have any solution for it? not sure if remote event receivers might be an approach to invest in to solve this issue (prevent users from deleting files but allow them to rename the files)?


Solution

  • There is no way to rename a file when you don't have delete permissions, and even remote event receiver doesn't solve the problem. Because renaming a file triggers a determination of whether the file has been deleted or not, and you don't have delete permissions, you'll get an access denied. Also using remote event receiver is too much of a hassle, maybe you could consider using a retention policy.