0

In a SPFX Webpart I need to know if the connected user has the right to modify a SharePoint list item.

To do so, I use a function of PNP JS :

sp.web.lists.getByTitle("ListTitle").items.getById(itemId).getCurrentUserEffectivePermissions().then((res) => {
    if (this._web.hasPermissions(res, PermissionKind.EditListItems)) {
        // user has right to modify item
    } else {
        // user has not right to modify item
    }    
});

Sometimes this request works well but sometimes It doesn't with no explanation. Furthermore, the user needs specific permissions to call this request. And I want to be able to determine If any regular user has the right to modify any list item.

Is there a better way to do so ? What am I doing wrong ?

Your Answer

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

Browse other questions tagged or ask your own question.