I want to restrict users from editing or deleting others documents, but they can edit/delete there own documents.

In list we get this functionality in advance settings, but in document library it is not available. I tried below two links to get that functionality in document library, but it didn't gave any effect on document library.



Some blogs advised to do it using event receiver, but how to check the user who triggered the event is author or not?

If there is another solution for my scenario that will be also welcomed.

  • Have you tried using a list validation where [Created By]=[Modified By]?
    – user43828
    Commented Jul 1, 2015 at 17:17
  • Hi Solomon, my issue got resolved by below answer. But still i will be interested in what you suggested. Do you have any examples on how to do this. I checked validation setting of document library, but created by and modified by column were not there to add in formula.
    – P S
    Commented Jul 2, 2015 at 6:59

1 Answer 1


my issue got resolved with help of below link https://dotnetadil.wordpress.com/2012/04/11/sharepoint-item-deleting-event-receiver-deny-delete/

I used below code

    public override void ItemDeleting(SPItemEventProperties properties)

                using (SPWeb web = properties.OpenWeb())
                    SPUser creator = new SPFieldUserValue(web, properties.ListItem["Author"].ToString()).User;
                    SPUser currentuser = web.SiteUsers.GetByID(properties.CurrentUserId);

                    bool isCurrentUserCreator = creator.ID.Equals(currentuser.ID);

                    if (!isCurrentUserCreator)
                        string errormsg = "You can delete own documents only";

                        properties.ErrorMessage = errormsg;
                        properties.Status = SPEventReceiverStatus.CancelWithError;   

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.