Monday, October 5, 2015

Preventing users from deleting an item from a list or Site

List

if (properties.ListTitle == "Project")
        {
            properties.Cancel = true;


        }

Site

public override void WebDeleting(SPWebEventProperties properties)
{
    properties.Status = SPEventReceiverStatus.CancelWithError;
    properties.ErrorMessage = "This site unable to deleted.";
    properties.Cancel = true;

}

No comments:

Post a Comment