Welcome to my personal blog, All the information in this bogs is my ideas,findings and thoughts on .Net, Asp.Net and SharePoint.
ALL POSTING ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND
1: SPSite site = null;
2: SPWeb web = null;
3: site = new SPSite("http://server:100/sites/DevSite/"); 4: web = site.OpenWeb();
5: SPRoleAssignment roleAssignment = new SPRoleAssignment("domain\\user","alias@domain.com","Nishand","Simple Test For You!"); 6: SPRoleDefinition roleDefinition = web.RoleDefinitions.GetByType(SPRoleType.Contributor);
7: roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
8: web.RoleAssignments.Add(roleAssignment);
Enjoy!!!
Anonymous comments are disabled