SPUser oUser=web.AllUsers[“domain/username”];
SPRole admins = web.Roles[“Full Control”];
admins.AddUser(oUser.LoginName, oUser.Email, siteRequestor.User.Name, “Notes”);
Or
web.AssociatedOwnerGroup.AddUser(oUser);
Or
SPRoleDefinition roleDefination;
SPRoleAssignment roleAssignment;
roleDefination = web.RoleDefinitions[“Full Control”];
roleAssignment = new SPRoleAssignment(oUser);
roleAssignment.RoleDefinitionBindings.Add(roleDefination);
web.RoleAssignments.Add(roleAssignment);
SPRole admins = web.Roles[“Full Control”];
admins.AddUser(oUser.LoginName, oUser.Email, siteRequestor.User.Name, “Notes”);
Or
web.AssociatedOwnerGroup.AddUser(oUser);
Or
SPRoleDefinition roleDefination;
SPRoleAssignment roleAssignment;
roleDefination = web.RoleDefinitions[“Full Control”];
roleAssignment = new SPRoleAssignment(oUser);
roleAssignment.RoleDefinitionBindings.Add(roleDefination);
web.RoleAssignments.Add(roleAssignment);
No comments:
Post a Comment