I am trying to add a webpart that will be able to share several different types of items in SharePoint 2013 OnPremises. I am using the following code, which seems to work well with one exception.

function shareDocSet(){
var restSource = "http://sharepointsite.com/sites/siteName/_api/SP.Sharing.DocumentSharingManager.UpdateDocumentSharingInfo";

    'url': restSource,
    'method': 'POST',
    'dataType': 'text',
    'data': JSON.stringify({
        'resourceAddress': 'http://sharepointsite.com/sites/siteName/Lists/Custom List/Test1',
        'userRoleAssignments': [{
            '__metadata': {
                'type': 'SP.Sharing.UserRoleAssignment'
            'Role': 2,
            'UserId': 'i:0#.w|domain\\john.smith'
        'validateExistingPermissions': true,
        'additiveMode': true,
        'sendServerManagedNotification': false,
        'customMessage': "Please look at the following folder",
        'includeAnonymousLinksInNotification': false
    'headers': {
        'content-type': 'application/json;odata=verbose',
        'X-RequestDigest': $('#__REQUESTDIGEST').val(),
        'Accept': 'application/json;odata=verbose'
    'success': function (data) {
        var d = data;
    'error': function (err) {

This code successfully shares all items in a document library(Folders, DocSets, and Documents) as well as list items in a custom list. However it does not share Folders in a custom list where folders have been enabled. When I try to share one of these folders I get a success callback but it just returns an empty results array in the UpdateDocumentSharingInfo object, where I would expect to see the user and the role they have been given. Checking the folder in question indicates that inheritance has not been broken on the item and the user has not been granted access. The only possible explaination I can think of is maybe there is some additional property I need to enable on a list before I can share folders?

  • 1
    You will most likely have to break inheritance on the folder first. Jul 14, 2018 at 0:22
  • Sharing a file, docset, folder in a doc library, or regular list item breaks inheritance automatically, so I don't see why a folder in a list would be any different. Just to be sure I did try breaking inheritance on the folder and then sharing it but I still encountered the exact same behavior as before.
    – James11
    Jul 16, 2018 at 14:41


Your Answer

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

Browse other questions tagged or ask your own question.