How to enable Anonymous Access to a blog site on your Office 365 public website

This has been plaguing the forums for weeks now .. if I had a pound for everytime I’ve seen someone complaining about blogs on Office 365 .. I’d have .. erm .. about £15 ..

But seriously, this is something that a lot of folks have been complaining about .. but no more! 🙂

One thing that definately surprised me is that you can set anonymous permissions through Sandbox Solutions! This means that we can write our own custom code to enable full anonymous access for comments, categories and posts 🙂 So I’ve done just that.

A link to download a Sandbox Solution can be found below. Just upload the WSP to your public website site collection, activate it, and drop the new “Hatch Solutions” web part onto the home page of your blog 🙂

NOTE: For those who aren’t interested in how this works, and just want the web part, you can grab the WSP package here.

This installs a Web Part. Place this webpart on the home page of your Blog site, and hit the big button… it should do all of the work for you.

Important: You don’t need to keep the webpart on there. Once you’ve checked it is working you can remove the webpart and remove the WSP from your Solution Gallery!

Regional Settings –  There have been numerous reported issues regarding regional settings (as the code looks for lists called “Posts” and “Comments”). Currently this WSP only works when your SharePoint Site regional settings are set to English.

So what are we doing?
This is really quite simple. The SharePoint API exposes the list permissions for anonymous users through an SPList property called AnonymousPermMask64. This is an enumeration of SPBasePermissions values which effectively describe what access anonymous users have.

The reason this doesn’t work by default for anonymous users is because the “ViewFormPages” permissions is not included by default!

So our code is quite simple:

// get the “Comments” list
SPList list = SPContext.Current.Web.Lists[“Comments”];

// check if it has unique permissions

// make sure people can edit their own items
list.WriteSecurity = 2;

// grant permissions to anonymous users
list.AnonymousPermMask64 =
  (SPBasePermissions.Open |
   SPBasePermissions.OpenItems |
   SPBasePermissions.ViewFormPages |
   SPBasePermissions.ViewListItems |


So all we are doing there is granting some additional permissions (ViewFormPages, ViewListItems and AddListItems) for anonymous users. Then we just rinse-and-repeat for Posts and Categories (but remember to remove the “AddListItems” bit!! otherwise anonymous users would be able to create new blog posts!).

That’s it! I have a (short-lived) demo running on my current Office 365 site:

Note – depending on how much spam and rubbish ends up on there, I will probably delete it sooner rather than later. I’ll try and remember to update this post after I have.
To make this easy for you I have built a Web Part which you can download and install (link at the top of this post) which does all of the work for you.

So that is all you should need .. happy blogging folks!! (all we need now is a decent blog template with things like CAPTCHA.. )

  • Jan Vanderstappen

    Hi Aladdin,

    I got the same problem but I solved it by just going to the solutions page using the url.

    Add _catalogs/solutions/Forms/AllItems.aspx at the end of your URL and you should go to the solutions page.

    Don't forget to raise your site resources. For me, the default setting was 0 on my public SharePoint online site.

    @Martin… Brilliant solution! Thanks!

  • Martin Hatch


    Yes lots of changes in the latest Wave release.

    I believe SPServices (the jQuery library which uses Web Services) still works for the public website. Might be worth looking to see if you can use the Web Service calls for this?

    Otherwise this might end up being a dead end in the latest wave (I've not really looked that closely)

  • Aladdin Anvar


    I have office 365 – P1 plan.
    I cannot use add solutions there. In site settings there is no solution gallery available in new office 365. (I don't know why they took out a lot of options from P1 plan).
    Looks like I cannot use ECMA script in new office 365 any more.
    How can I apply the above code in office 365 P1 plan?
    I am talking about the code starts with:
    SPList list = SPContext.Current.Web.Lists["Comments"]; ….

    Thanks for your feedback.

  • Anonymous

    Thanks a million! I used for solution for a different purpose. I can't open my public website in Sp designer before i installed your brilliant solution! thanks for sharing!

  • Martin Hatch


    You need to go to your public website "sign in" and go to Site Settings > Solution Gallery.

    You can upload it there


  • Mike


    Nicely done. It worked like a charm!


  • Anonymous

    Ok, I am having a hard time understanding your directions. This is the part I am having trouble with

    A link to download a Sandbox Solution can be found below. Just upload the WSP to your public website site collection, activate it, and drop the new "Hatch Solutions" web part onto the home page of your blog 🙂

    I cannont find my public website site collection. I can't find it and I am probably overlooking it. I am new at this and need more information. Could you help please?
    Bob Rogers

  • Scott Livingston

    Thank you much! I started my own business last year, and use office365, thus sharepoint for my public website…very early on i became frustrated and taught myself how to create a master page and "break free" from Microsoft's design template utilizing designer to edit my site. When I created a blog sub-site yesterday, same issues…until i stumbled upon your site.

    Your solution saved me hours of work! I then went in and customized the forms and master pages to add in social plugins etc…Anyway, thanks a million. One of my first posts will be thanking you and a link to your site! Still in design, but check it out: (any further suggestions are always appreciated) – Scott

  • Xenox Garavito

    Thanks Martin,
    I've wrapped the concept into a simple to use, no-frills web part (and it's free) to allow the modification of Anonymous Permissions for any list within the website.

    Managing Anonymous User Permissions on Office 365 Small Business


  • George

    Hi Martin,
    I have tested it on my Office 365 public site but it doesn't work. It was successfuly deployed and activated, then I have successfuly put it on the blog site default page. But when I click to the button, i receive only: "Doh .. something went wrong. Are you sure you activated this on a BLOG site?"
    The architecture is very simple – I have created my blog web directly under public web site root site. Can You help me, please?
    Thank You

  • Martin Hatch

    Aye yes .. I tested before when my phone was in "desktop mode", but yes you do get redirected.

    I don't think the only plausible solution for this is some kind of page component which (in the OnInit event) detects the "?mobile=1" query string and strips it out for "?mobile=0" (which DOES work).

    I might try this and see if it works.

  • Nathan

    Martin, your solution is wonderful for the full site, but I'm having problems with the Mobile platform.

    I can reproduce the problem even with your example blog.

    If you goto you blog site, and goto site settings, the right hand side will have two URLS.

    Most likely it will be something like :

    Site Information
    Site URL:
    Mobile Site URL:

    Your solution works great for the first url, but when you put /?Mobile=1 on the end of the line, it breaks!

    How to Reproduce:

    #1 Write down the two urls
    #2 Log out of sharepoint 365 (very important!)
    #3 Try to access the two URLs, you will quickly notice, the main Site URL has annoynmous access, but the Mobile site prompts you to login to Office 365.

    As you can see, prompts for security. Any kind of solution to this would be wonderful!

    Thank You


  • Martin Hatch


    Thought this was a SharePoint Online feature. They pushed out a fix for this months back.

    Can you browse your main public website through a mobile? If not then I suggest you open a support ticket to get this resolved.

    I didn't have to do anything special for this to work on mine.

  • Amol

    Hi Martin
    I have used your wsp for my blog site. Now I am able to comment on post anonymously.
    Only problem is that If i try to open blog site from mobile phone it is not opening site. It asks for login and after login in Only i can see blogs. But if i am trying to open site on computer it is opening without any login.
    Can you please help me why this is happening.

  • Martin Hatch


    Have you managed to deploy and run the webpart / code with an authenticated user?

    Once you have done that, remove the web part from the page.

  • Ariel Andrés Quesada Saldarriaga

    It is not working for me. "The method GetItems of the type List with id is blocked by the administrator on the server". I have Office 365 E1 Plan. I can set permissions (I review that in list permissions), but … when an anonymous user enter… the "blocked" message appears.

    Any idea? I research and research but nothing works.


  • Martin Hatch

    Steven – Doh .. thanks for that. A shame that this isn't just generally supported.

    Anon – the code samples should work for most things, of course the back-end forms may still be locked down due to the publishing features. You might need to write your own custom web part (and be careful of spam!!)

  • Steven Buehler

    It unfortunately appears to break the ability to post from Windows Live Writer or Microsoft Word. I can't set up the blog on either client after using the anonymous 'hack' because the server is throwing in a redirect.

  • Anonymous

    Martin, This works great for teh lists. Another quick question – is there a way to do the same thing for a document library or a picture library? I want the anonymous users to upload pictures on a specific picture library. The Upload pop-up doesn;t appear properly. Any thoughts?


  • Martin Hatch

    Hi John,

    I just created a new sub-site using the "Blog" site template.

  • John Unger

    Hey Martin,

    Great work – I enjoy your site.

    I just started kicking the tires on Office 365 and have a P1 trial account going. I uploaded your wsp and clicked and it ran… Now for the Newb question… How did you get your POC Blog URL created?

  • Martin Hatch


    Good question, anonymous Search results is something a lot of people have been making noise about.

    You should be able to get this working using a "Search Center" sub-site.

    There is a blog article on this here:

  • Martin Hatch


    Send me an email using the Contact Us form at and I will send you the source code.

  • Anonymous

    Hi Martin,

    I noticed on your test blog that when I try to search the blog it asks me to authenticate. I have been beating my head trying to figure out any way on earth to make search possible to anonymous users from a welcome page or any design element on SharePoint Online. I have tried copying the code by hand from internal search parts (since I cant seem to add any search web parts to external pages even with your trick about making the external page more configurable), I have tried a million ways to enable the anonymous permissions (setanon.aspx page just dies out). I have the E3 plan.

    Might you have any advice on this?

    Thank you – Matthew

  • 法拉魚

    Hi Martin,
    can u give the code about sandbox mode?
    I'll fix your webpart and working in chinese blog 🙂

  • Lawrence Armour

    I uploaded the wsp to an Office 365 site, but I couldn’t find it to put it in a page. Has something changed, or am I being stupid. I could probably do it properly if I had the full project source code.

  • Ott

    I have uploaded this and run the web part on an office 365 public site blogging sub-site. Anonymous users can view all of the blog elements without needing to log in, but are blocked from posting a comment. Any thoughts?

  • Aladdin

    This web part perfectly allows anonymous user to add comment. But since The “created by” column of comment is empty or for any other reason the comment is NOT added to the blog. And “TypeError: Cannot read property ‘trim’ of null” error displayed instead. When you go to Manage comment you see the comment is added however blog doesn’t show new comment.
    Any idea???

  • Vatikaki

    i have uploaded it and activated it,then added it to the Blog and clicked on thebutton to sort out permissions. When i log in form another computer it still wants me to sign in first.

  • tabrez

    This is not working for SharePoint Online (2013 and 2016) with Office 365