开发者

Restrict the delete option from shared documents in sharepoint Server

I need to restrict the delete option from shared documents in sharepoint server according to the following criteria.

1) Users to be able to write files in a folder (which they cannot delete) and they cannot delete files from another users and only their own

2) I want to prevent delete option of folder and the list items of others

3) I want users to be able to delete their own li开发者_开发知识库st items?

How to set permission level?

please help me,Thanks in advance,


Item-level permissions are default only on Lists not Document Libraries, create a list and go to Settings => List Settings => General Settings => Advanced Settings and see if the "Item-Level Permissions" group fits your need. Once you decide that, you can check this feature made by Chakkaradeep that enables similar functionalities to your DocLib.

Then you have the programming option, in general terms you will need an EventHandler attached to your Document Library, more info on this link

Below is an untested sample typed from memory based on the msdn article I linked

public override void ItemDeleting(SPItemEventProperties properties)
{
    using(SPSite site = new SPSite(properties.SiteId))
    {
        using(SPWeb web = site.OpenWeb(properties.RelativeWebUrl))
        { 
            SPFieldUserValue user = new SPFieldUserValue(web, web.CurrentUser.ID, web.CurrentUser.LoginName);

            if(properties["Author"] == user)
               return;

            properties.Cancel = true;
            properties.ErrorMessage = "You cannot delete items created by other users";
        }
    }
}


I'm Kevin and I'm responsible for permissions in SharePoint

F. Aquino is right above - the list setting that restricts users from editing / deleting items created by others is only available on lists. You could accomplish this using custom code (as F. Aquino suggests above) or creating a library for each user (may not be a good idea if there are lots of users).


I was set permission level following order,

1.site settings > advanced permissions > permission levels >uncheck Delete option in Design and Contribute permission level

2.In Solution shared document library > settings > document library settings > permissions for this document library > I set Contribute level permission,but i don't want delete option to all users only and their own

Please find the below attached screenshots.

link text

link text

link text

link text

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜