tags:

views:

193

answers:

3

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 list items?

How to set permission level?

please help me,Thanks in advance,

+1  A: 

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";
        }
    }
}
F.Aquino
item-level permissions are available on both list items and documents
Kevin Davis
Aren't you confusing it with Draf-item Security?
F.Aquino
the list settings restricting users to editing their own etc are only on lists
Kevin Davis
you can individually permission items in libraries or lists
Kevin Davis
Yeah, that's what I meant! In my understanding, he wants that type of setting automagically doing the permissions, which led to my answer :) and by saying "Item-level permissions" I am pointing to the General Settings option in the List/DocLib Settings page. Not the concept itself.
F.Aquino
A: 

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

Kevin Davis
Kevin, would you be kind enough to provide some info on why this behavior exists? Not having the same option in doclibs as we do on lists? I guess it could be related to the Checkin/Checkout/Approval feature on SPFiles, which could break the functionality.
F.Aquino
Respecting this setting in the numerous ways you can access a doc lib (think DAV etc) would have been an enormous amount of work and we prioritized other things instead
Kevin Davis
A: 

Hi Aquino/Kevin,

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

Velmurugan