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
    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. – Gautam Sheth Nov 19 '17 at 14:07
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.

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.