Question

I've created an anonymous blog subsite. My root site is also anonymous. I can access default.aspx anonymously, but not /Lists/Posts/Post.aspx?ID=1

I've tried breaking permission inheritance and have tried toggling on all anonymous access options within the Comments list and even the Posts list. When navigating to these lists, I get a 401 Unauthorized error message.

Am I missing something?

Was it helpful?

Solution

Below is the solution, however the issue of anonymous users being able to see draft items has cropped up...

SPList list = curWeb.Lists["Comments"];
// check if it has unique permissions
if (!list.HasUniqueRoleAssignments)
{
    list.BreakRoleInheritance(true);
}
// make sure people logged in can edit their own items
list.WriteSecurity = 2;
// turn on moderation
list.EnableModeration = true;
list.DraftVersionVisibility = DraftVisibilityType.Approver;
// grant permissions to anonymous users
list.AnonymousPermMask64 =
  (SPBasePermissions.Open |
   SPBasePermissions.OpenItems |
   SPBasePermissions.ViewFormPages |
   SPBasePermissions.ViewListItems |
   SPBasePermissions.AddListItems);
list.Update();
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top