0

I have Read User having read Permission.

I'm trying to update the list item using JSOM. But I get below error

"Access denied. You do not have permission to perform this action or access this resource."

    try {
    var list = clientContext.get_site().get_rootWeb().get_lists().getByTitle("ListName");

    var reportListItem = list.getItemById(CommentId);
    reportListItem.set_item('Reported_Flag', '1');
    reportListItem.set_item('Report_Comment', commentText);
    reportListItem.update();

    clientContext.executeQueryAsync(function () {
        $('#reportModal textarea').val("");
        $("#reportModal").modal("hide");



    }, function (xhr, textStatus, errorThrown) {
        ULS.enable = true
        ULSOnError(" - Unable to get report the comment in Comments list - " + textStatus + errorThrown, location.href, 0)
    });
}
catch (error) {
    console.log("  - " + error.message);
    ULS.enable = true;
    ULSOnError(" - " + error.message, location.href, 0);
}
1
  • 1
    You can't update using Read permission. You need to elevate the permission to Write on the list at least. Also, if you are going to be doing this on multiple lists, would make sense to give Full control on the web. Commented Nov 19, 2017 at 14:07

2 Answers 2

0

Using JSOM you have the exact same permissions as the current user (no more and no less), so if the current user only have read permission, then you can't update.

0

You cannot update the list items using JSOM with only Read permission.

In order to add/update/delete list items, you should at least have Contribute permissions.

For more understanding, check below article:

Understanding permission levels in SharePoint.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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