4

I am trying to assign the existing SharePoint Group Permission to my folder in Document Libray.

I am using following code:

var roletypes = clientContext.Web.RoleDefinitions.GetByType(RoleType.Editor);
clientContext.ExecuteQuery();

List list = clientContext.Web.Lists.GetByTitle("TestLibrary1");
list.BreakRoleInheritance(true, false);

RoleDefinitionBindingCollection collRoleDefinitionBinding = new RoleDefinitionBindingCollection(clientContext);
collRoleDefinitionBinding.Add(roletypes);
list.RoleAssignments.Add(grp, collRoleDefinitionBinding);

Everything is fine but the problem is when I try to select RoleType as Editor, its giving error.

So my question is what may be the possible reason for missing RoleType.Editor?

5

Editor roletype is not available in 2010, it was introduced in 2013

Compare

RoleType (2010)

with

RoleType (2013)

3

I believe you are missing the Load statement.

Try

clientContext.Load(roletypes);
clientContext.ExecuteQuery();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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