Where would you like to go, Toady? 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

Stackoverflow.com Rep
Flickr stream
Archive
<January 2010>
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456
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: 46
This Year: 11
This Month: 2
This Week: 0
Comments: 11
All Content © 2010, Chris Ballance

Valid XHTML 1.0 Transitional