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.

2

Try to get user effective permissions as the following

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

Also, check

  • 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 Nov 5 '18 at 21:59

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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