Wednesday, June 13, 2007

Programmatically setting anonymous access to a list

To programmatically turn on anonymous access to a list:

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

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: