Sp Service

Jul 27, 2010 at 8:40 PM
Edited Jul 27, 2010 at 11:05 PM

How possible to have to operations?
i want to get

operation: "GetPermissionCollection",
operation: "GetGroupCollectionFromUser",

 

Coordinator
Jul 27, 2010 at 9:44 PM

Both of these operations are already in the library, and have been almost from the first public release.

M.

Jul 27, 2010 at 11:08 PM
Edited Jul 28, 2010 at 4:32 PM

I meant how do I GetPermissionCollection as well as GetUserCollectionFromSite in the same time, but I got the RoleName undefined.

  $("#WSOutput").html("").SPServices({
   operation: "GetPermissionCollection",
    objectType: "Web",
 operation: "GetUserCollectionFromSite",
 completefunc: function (xData, Status) {
  $("#WSOutput").html("").append("<b>User Info:</b>");
  $("#WSOutput").html("").append("<b>Name</b> &nbsp;&nbsp;&nbsp;<b>Login Name</b>&nbsp;&nbsp;&nbsp;<b>Email</b>&nbsp;&nbsp;&nbsp;<b>Site Admin</b>&nbsp;&nbsp;&nbsp;<b>Domain Group</b>");
  $(xData.responseXML).find("User").each(function() {
   $("#WSOutput").append("<td style='font-size:8pt';>" + $(this).attr("Name") + " " + $(this).attr("LoginName") + " " + $(this).attr("Email") + " " + $(this).attr("IsSiteAdmin") + " " + $(this).attr("IsDomainGroup") + " " + $(this).attr("RoleName") + "</td>")
  });
 }
});

 

 

Thank you

 

Coordinator
Jul 29, 2010 at 4:41 AM

No, you're trying to mash together calls to two separate Web Service operations. You'll need to make the two calls separately and manage the results to display what you want.

M.

Dec 3, 2010 at 1:27 AM

Hi Marc,

I am using following code,

$().SPServices ({ url: "/_vti_bin/permissions.asmx", operation:"GetPermissionCollection", async: false, objectName: "MyAnnouncements", objectType: "List", completefunc: function (xData, Status) {

  alert(xData.responseXML.xml);

  } // end – completefunc

}); // end – SPServices

And below is what i am getting as output,

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body>

<GetPermissionCollectionResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/"><GetPermissionCollectionResult><GetPermissionCollection>

<Permissions>

<Permission MemberID="2" Mask="-1" MemberIsUser="True" MemberGlobal="False" UserLogin="CS\l809286"/>

<Permission MemberID="7" Mask="134287360" MemberIsUser="True" MemberGlobal="False" UserLogin="CS\k060463"/>

<Permission MemberID="9" Mask="134287360" MemberIsUser="True" MemberGlobal="False" UserLogin="CS\o654819"/>

<Permission MemberID="10" Mask="-1" MemberIsUser="True" MemberGlobal="False" UserLogin="CS\m656423"/>

<Permission MemberID="13" Mask="134287360" MemberIsUser="False" MemberGlobal="True" GroupName="PAS Authenticated Users"/>

</Permissions></GetPermissionCollection></GetPermissionCollectionResult></GetPermissionCollectionResponse>

</soap:Body></soap:Envelope>

Why i am not getting the "RoleName" attribute in my response ?

 

 

Coordinator
Dec 3, 2010 at 2:53 AM

You're getting back what SharePoint sees in the permissions for the MyAnnouncements list. The results will vary based on your particular settings. SPServices doesn't change anything about what comes back from the Web Services; just allows you to call them easily.

BTW, the option url: "/_vti_bin/permissions.asmx" is not needed for this call and will be ignored. 

M.

Dec 3, 2010 at 10:04 PM
Edited Dec 4, 2010 at 12:25 AM

I agree with your point that i am getting back what SharePoint sees in the permissions.

But this is what according to MSDN documentation should be the structure of the response SOAP envelop,

<GetPermissionCollection xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/">  

<Permissions>      

<Permission MemberID="1073741829" Mask="-1" MemberIsUser="False" MemberGlobal="False"          RoleName="Administrator" />      

<Permission MemberID="1073741828" Mask="1029638927" MemberIsUser="False" MemberGlobal="False"          RoleName="Web Designer" />      

<Permission MemberID="1073741827" Mask="1027801615" MemberIsUser="False" MemberGlobal="False"          RoleName="Contributor" />      

<Permission MemberID="1073741826" Mask="138608641" MemberIsUser="False" MemberGlobal="False"          RoleName="Reader" />      

<Permission MemberID="1073741825" Mask="134283264" MemberIsUser="False" MemberGlobal="False"          RoleName="Guest" />      

<Permission MemberID="1073741830" Mask="134414337" MemberIsUser="False" MemberGlobal="False"          RoleName="Site_Group1" />      

<Permission MemberID="1073741831" Mask="134283265" MemberIsUser="False" MemberGlobal="False"          RoleName="Site_Group2" />

         .         .         .

</GetPermissionCollection

My point is either a webservice method should throw an error or give the response in the format expected.

It dose not convince me that i can't  get the 'RoleName' attribute bcz my WSS 3.0, WIN 2003 environment is set like that ?

But i need that information.

Is there some other way to get it or its THE END ?

 

Thanks.

Coordinator
Dec 5, 2010 at 9:29 PM

Unfortunately the MSDN documentation is spotty at best. They are showing you one potential response for the operation. The settings for your list determine exactly what you get back.

I would assume that the response you show above reflects the current permission settings of your MyAnnouncements list?

As an example, here's what I get back for one particular list in my test site:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <soap:Body>
  <GetPermissionCollectionResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/directory/">
   <GetPermissionCollectionResult>
    <GetPermissionCollection>
     <Permissions>
      <Permission MemberID="4" Mask="-1" MemberIsUser="False" MemberGlobal="True" GroupName="Site Owners" >
      </Permission>
      <Permission MemberID="5" Mask="1011028719" MemberIsUser="False" MemberGlobal="True" GroupName="Site Members" >
      </Permission>
      <Permission MemberID="146" Mask="-1" MemberIsUser="True" MemberGlobal="False" UserLogin="FPSHARED1\bkates" >
      </Permission>
      <Permission MemberID="147" Mask="-1" MemberIsUser="True" MemberGlobal="False" UserLogin="FPSHARED1\abray" >
      </Permission>
      <Permission MemberID="1073741823" Mask="134287360" MemberIsUser="True" MemberGlobal="False" UserLogin="SHAREPOINT\system" >
      </Permission>
     </Permissions>
    </GetPermissionCollection>
   </GetPermissionCollectionResult>
  </GetPermissionCollectionResponse>
 </soap:Body>
</soap:Envelope>
M.
Dec 6, 2010 at 10:21 PM

Thanks Marc.

Let me test your patience further.... :)


Did you ever used 'GetPermissionCollection' and got the 'RoleName' attribute .If 'Yes', then what permissions and settings should be in place to get 'RoleName'.
My user is a Site collection Administrator and having full control over the Sites i had tried for.I did tried for the sies having Anonymus access and for secured sites also.I did tried with the Lists where permission were inherited and for lists where inheritence was broken.
But, the result was the same. I am not able to see 'RoleName' attribute anywhere except for the MSDN documentation. 


Thanks.


Amit Tyagi

Coordinator
Dec 7, 2010 at 2:42 AM

Amit:

I don't see RoleName in any of my test sites, either. Maybe we should take a step back and you should tell me what you are actually trying to accomplish.

M.

Dec 7, 2010 at 8:03 AM

 

Marc,

Thanks for giving time for this....
Actually my immediate requirement is just to create a page which will allow me to select a site from a dropdown having all the sites within my portal. It would display information for all the users and Groups having permissions over this selected site. When i say information, i mean user-name, login-id, email-id and ROLENAME (basically what level of permissions that user/group is having over this site).

Later i need to derive this information at List level. Thats it....... :)


Amit Tyagi

Coordinator
Dec 8, 2010 at 6:33 PM

Such a seemingly simple thing, yet far from trivial.

I think you should look at the Users and Groups Web Service instead. It has many operations which added together should let you get at what you want.  But it may not be possible to get to exactly what you describe.

M.

Dec 9, 2010 at 1:18 AM

Thanks for writing this encouraging statement 'Such a seemingly simple thing, yet far from trivial.'     :)

This thing was really sucking me up.

I will try it out using 'Users and Groups' web service. 

 

Amit Tyagi