1

Is there a way to get all the SharePoint list/library names having unique permission of a particular site collection using web services.

I am working on SharePoint 2007 site and hence web services will be of 2007.

2
  • Update: WS_SiteData.SiteData ss = new WS_SiteData.SiteData(); ss.Credentials = new NetworkCredential("xx", "yyy"); WS_SiteData._sListMetadata lstMetaData; WS_SiteData._sProperty[] lstFields; ss.GetList("Carrom Register", out lstMetaData,out lstFields); if(lstMetaData.InheritedSecurity == false) { MessageBox.Show("false"); } I tried this but I am getting false for all lists with unique or non-unique permissions?? Commented Jan 18, 2016 at 10:38
  • my mistake, The lists i was checking was having unique permissions. Its returning true for Non-unique one. thanks. Commented Jan 18, 2016 at 10:45

1 Answer 1

1

You can use SpServices to achieve this, it will happen in 2 steps:

  1. Get all list names in an Array (below I'm logging it but you'll need to push it to an Array)

    $().SPServices({ 
        operation: "GetListCollection", 
        completefunc: function( xData, Status ) {
            console.log( Status );
            console.log( xData.responseText );
    
            $( xData.responseXML ).find("Lists > List").each(function() {
                var $node = $(this);
    
                console.log( $node.attr("Title") );
            });
        }});
    
  2. Now loop through all the items of array one by one and use below script:

You will need to use the SiteData service. A basic example:

$().SPServices({
      operation: "SiteDataGetList",
      strListName: "Announcements", //here you'll refer array value
      async: false,
      completefunc: function(xData, Status) {}
});

This will return a node sListMetadata. If the list inherits permissions it will have an attribute of <InheritedSecurity>true</InheritedSecurity>. If the list is using custom permissions, it will have a <Permissions> node and give all the permissions.

6
  • Any other alternative using Web services.. We have a SiteData Webservice as well but I was not able to get unique permissions. Commented Jan 18, 2016 at 9:37
  • What was the response?
    – Taran Goel
    Commented Jan 18, 2016 at 9:50
  • Ok.. I guess I got a step closer. I used the Sitedata webservice as below as was able to get Inherited permission object as false in the metadata. Now I only have to figure out to check it. I guess I can go frm here. Thanks.. WS_SiteData._sListMetadata lstMetaData; WS_SiteData._sProperty[] lstFields; ss.GetList("Announcements", out lstMetaData,out lstFields); foreach(WS_SiteData._sProperty field in lstFields) { Commented Jan 18, 2016 at 10:23
  • Cool, use the permission tag to get the permissions. Mark it as answered if it helped you:)
    – Taran Goel
    Commented Jan 18, 2016 at 10:27
  • I tried with other lists wid unique n inherited permissions. but its returning false al the time?It shld return false only fr unique one lists.What wrong am i doing?:( WS_SiteData.SiteData ss = new WS_SiteData.SiteData(); ss.Credentials = new NetworkCredential("xx", "yyy"); WS_SiteData._sListMetadata lstMetaData; WS_SiteData._sProperty[] lstFields; ss.GetList("Carrom Register", out lstMetaData,out lstFields); if(lstMetaData.InheritedSecurity == false) { MessageBox.Show("false"); } Commented Jan 18, 2016 at 10:36

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.