SPRoleAssignment roleassignment;
SPRoleDefinitionCollection webroledefinitions = web.RoleDefinitions;
SPRoleDefinitionCollection webroledefinitions = web.RoleDefinitions;
SPDocumentLibrary docLib =
(SPDocumentLibrary)web.Lists[“LibraryName”];
SPUser oUser =
web.EnsureUser(“domain\\loginname”);
roleassignment = new SPRoleAssignment(oUser);
roleassignment.RoleDefinitionBindings.Add(webroledefinitions[“Read”]);
docLib.RoleAssignments.Add(roleassignment);
docLib.Update();
roleassignment = new SPRoleAssignment(oUser);
roleassignment.RoleDefinitionBindings.Add(webroledefinitions[“Read”]);
docLib.RoleAssignments.Add(roleassignment);
docLib.Update();
No comments:
Post a Comment