Reputation: 555
I have used Javascript and sharepoint client object model to add a list item to a list. I am working with a sharepoint 2013 online public site. I have a content editor with the following javascript code.
var clientContext = new SP.ClientContext.get_current();
var web = clientContext.get_web();
var list = web.get_lists().getByTitle('Subscriptions');
var email = document.getElementById('email').value;
// Create a new list item
var itemCreateInfo = new SP.ListItemCreationInformation();
var listItem = list.addItem(itemCreateInfo);
listItem.set_item('Title',email );
listItem.update();
This code works fine for the user who has permission. it will add a element to the subscription list. But it fails when we use this for a Anonymous user. After searching I found that that there is a tool : http://anonymous365.codeplex.com/.
But it did not work from the code though i gave anonymous access to the list.
Please suggest me a way to overcome this.
Thanks,
Upvotes: 0
Views: 4493
Reputation: 5496
Access to SharePoint Online requires an authenticated session of some variety. The only site that is available for public (anonymous) access is the pre-provisioned "public site" that is available with certain subscriptions which is meant to host a standard corporate website. A sample project that shows how to support claims authentication with SPO can be found here: http://code.msdn.microsoft.com/office/Remote-Authentication-in-b7b6f43c/
Upvotes: 1