1

I can add a role to a document with this code:

var REST = globalvars.absoluteUrl + "/_api/SP.Sharing.DocumentSharingManager.UpdateDocumentSharingInfo";

var data = JSON.stringify({
    'resourceAddress': fileAdress,
    'userRoleAssignments':
        [{
            '__metadata': { 'type': 'SP.Sharing.UserRoleAssignment' },
            'Role': role,
            'UserId': sharedWith
        }],
    'validateExistingPermissions': false,
    'additiveMode': true,
    'sendServerManagedNotification': sendEmail,
    'customMessage': contentEmail,
    'includeAnonymousLinksInNotification': false
});

But I don't know how to retrieve this information.

1 Answer 1

2

Try to get user effective permissions as the following

/_api/web/lists/getbytitle('" + Library Title + "')/getusereffectivepermissions(@user)?@user='" + encodeURIComponent(accountName) + "'"

Also, check

1
  • 1
    Thank you. I found query to specific list item on your link. url: "<app web url>/_api/SP.AppContextSite(@target)/web /lists(guid'a290086b-2d43-4151-add4-893474a930a9')/items(2) /getusereffectivepermissions(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%40domain.onmicrosoft.com' &@target='<host web url>'",
    – Joao Paulo
    Commented Nov 5, 2018 at 21:59

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.