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

john john 961 Reputation points
2023-08-21T23:57:01.4433333+00:00

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)?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,716 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,989 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ling Zhou_MSFT 17,150 Reputation points Microsoft Vendor
    2023-08-22T07:59:59.9433333+00:00

    Hi @john john,

    Thanks for your detailed case description. I completely understand the situation and your feelings.

    But according to the official file, I feel regretful to inform you that users who don't have delete permissions also can't change the file name, as designed by SharePoint.

    User's image

    Reference: Contributor users are not able to rename items in SharePoint if the Delete permission level is removed from the Contributors group

    Please accept my sincerely apologizes for any inconvenience this may cause. Thank you for your kind understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.