Quantcast
Viewing all articles
Browse latest Browse all 10096

WF 4.5 or Event Receiver/Handler for Document Library in SharPoint Online 2013?

I need to change file/item permissions on a document to data in a people column when the document is create or edited based on some column properties.

WF/SPD 2013 does not appear to offer this option.

Is this possible with VS 2012 4.5 Workflows?

How about an event reciever like this? But how and where do I implement this?

public override void ItemAdded(SPItemEventProperties properties)
 {
 base.ItemAdded(properties);
 SPListItem li = properties.ListItem;
 li.BreakRoleInheritance(false);
 SPRoleAssignment groupRoleAssignement = new SPRoleAssignment((SPPrincipal)li.ParentList.ParentWeb.Site.RootWeb.Groups["Demo Members"]);
 SPRoleDefinition goupRoleDefinition = li.ParentList.ParentWeb.Site.RootWeb.RoleDefinitions.GetByType(SPRoleType.Contributor);
 groupRoleAssignement.RoleDefinitionBindings.Add(goupRoleDefinition);
 li.RoleAssignments.Add(groupRoleAssignement);
 }


============================
Thank You
cyberpine.com




Viewing all articles
Browse latest Browse all 10096

Trending Articles