3

I am using SharePoint 2010 JavaScript Client Side Object Model to create and update list items on a SharePoint Survey list. In my use case users are anonymous .

New items are created properly (Create List Item) but there is a problem with Updating list item by ID. Item can be created by anonymous user but cannot be updated. Error message: Request failed. Access denied. You do not have permission to perform this action or access this resource

Creating list item (anonymous user) - works OK, item is created

function createListItem() {

var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('Survey list');

var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);

oListItem.set_item('TestField', 'Test value');

oListItem.update();

clientContext.load(oListItem);

clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));}

Updating list item by ID 13 (anonymous user) - Request failed. Access denied. You do not have permission to perform this action or access this resource

function updateListItem() {

var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('Survey list');

this.oListItem = oList.getItemById(13);

oListItem.set_item('TestField', 'Updated value');

oListItem.update();

clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));}

Have you experienced problems with updating list item for anonymous users? Does this operation require additional rights / authentication? Anonymous access is enabled to Add Items ; Edit items. Can it be a problem with a FormDigest?

<SharePoint:FormDigest ID="FormDigest1" runat="server"></SharePoint:FormDigest>
  • 1
    Make sure you have uncheck this option:Require Use Remote Interfaces Permission under site Permissions-Anoymous access and View Items permissions should also be provided – Deepmala Dec 18 '17 at 11:24
0

You need to check first the permission level of this user. There might be instances that the permission level in which this user is under is customized.

To check the permission level customization. Open Site Permissions > Permission Level, then choose the permission level the user belongs. Under Edit Permission Level, check whether the Edit Items option is checked.

It should be something like this.

enter image description here

Of course, you need to have an administration permission to access this option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.