2010: The year we make contact RSS 2.0
# Wednesday, January 06, 2010
private static void SetListPermissions(SPList list, SPWeb web)
{
    try
    {
        list.BreakRoleInheritance(false);

        SPRoleDefinition readerRole = web.RoleDefinitions.GetByType(SPRoleType.Reader);

        SPUser allUser = web.AllUsers["NT Authority\\Authenticated Users"];

        SPRoleAssignment spRoleAssignment = new SPRoleAssignment(allUser);
        spRoleAssignment.RoleDefinitionBindings.Add(readerRole);

        list.RoleAssignments.Add(spRoleAssignment);
        list.Update();
    }

    catch (Exception ex)
    {
        //Log Exception
        throw;
    }
}
Wednesday, January 06, 2010 1:22:46 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Bookmark, Tweet, or Share

OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
Stackoverflow.com Rep
Flickr stream
Archive
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Chris Ballance
Sign In
Statistics
Total Posts: 41
This Year: 6
This Month: 0
This Week: 0
Comments: 9
All Content © 2010, Chris Ballance

Valid XHTML 1.0 Transitional