Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Say I have a document Library "TravelRequests" and five different content types associated with library. Is there a way to apply permission for a given content type "ManagerCT"? When managers are uploading item to this library they pick ManagerCT content type and load items with metadata. Now I dont want Joe Smith who is custodian to see the items that that has ManagerCT associated with them.

Possible? if yes, how... Any help would be great.

Thanks

share|improve this question
add comment

3 Answers

up vote 0 down vote accepted

http://mindsharpblogs.com/pauls/archive/2007/05/07/1754.html

Looks like this guy has to solution. I still have to use ItemAdded event handler.

public class ItemSet : SPItemEventReceiver { public override void ItemAdded(SPItemEventProperties properties) { base.ItemAdded(properties);

 SPWeb web = properties.OpenWeb();
 SPList list = web.Lists[properties.ListId];
 SPRoleAssignmentCollection roles = list.RoleAssignments;;

 SPListItem addedItem = properties.ListItem;
 addedItem.BreakRoleInheritance(false);
 foreach (SPRoleAssignment r in roles)
 {
   if (r.Member.Name.ToString().StartsWith(properties.ListItem.ContentType.Name
     .ToString(), StringComparison.CurrentCultureIgnoreCase))
   {
     addedItem.RoleAssignments.Add(r);
   }
 }
 this.DisableEventFiring();
 addedItem.Update();
 this.EnableEventFiring();

} }

share|improve this answer
add comment

You can do this with SharePoint Designer List Workflows using an Impersonation Step. In the Impersonation Step you can alter permissions of an item in the list. First check the valule of the Content type in the current list. If the value of the content type is "Manager CT" create an impersonation step and change your permissions. Choose the action "Replace List Item Permissions" and set the new permissions on the item. Remember that you need to re-grant permission for every group because the action "Replace List Item Permissions" removes all permission that are exisiting.

share|improve this answer
add comment

You can set a List Item Event Handler on the "TravelRequests" library, override the "ItemAdding" method, which will give you a reference to the actual item (passed in through SPItemEventProperties.ListItem property,) and check for the value of "ManagerCT" being assigned to the item's ContentType field.

If assigned, you can alter the item level permission; (but not without reading the following article describing the gotcha's of doing this programatically):

http://www.chakkaradeep.com/post/SharePoint-ndash3b-Setting-Item-level-permission.aspx

share|improve this answer
    
I have done item level permission with event handler. I was hoping sp2010 might have better way of handling these type of situation. Thanks gn22. I just needed confirmation that there is no OOTB solution for this or 3rd party. –  Raula Ryan Sep 15 '11 at 3:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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