Wednesday, June 13, 2007

Programmatically setting anonymous access to a list

To programmatically turn on anonymous access to a list: http://www.u2u.info/Blogs/Patrick/Lists/Posts/Post.aspx?ID=876

'-------------
Dim web As SPWeb = New SPSite("http://").OpenWeb()
Dim list As SPList = web.Lists("")
list.AnonymousPermMask = sprights.ViewListItems | sprights.OpenWeb |
sprights.ViewPages
'-------------

For disable the anonymous on your list, you only need to specify the
SPRights.EmptyMask to the AnonymousPermMask Property.
list.AnonymousPermMask = SPRights.EmptyMask

No comments: