Getting the userinfo from specific sharepoint site using sharepoint web service
I am using /_vti_bin/usergroup.asmx service and getting the userinfo using GetAllUserCollectionFromWeb(). But i need to pass in the specific site and need to get the users info of that site alo开发者_StackOverflowne. Which sharepoint service to use? How to get that?
Thanx in advance
There are 3 methods available for getting users from web or site collection:
- GetAllUserCollectionFromWeb - Returns information about the collection of users for the current Web site.
- GetUserCollectionFromSite - Returns information about the collection of users for the current site collection.
- GetUserCollectionFromWeb - Returns information about the collection of users for the current Web site. (let me guess, it will only return users explicitly assigned permissions to that web ONLY, but you check it yourself)
Alternatively, in code, there are also 3 properties: AllUsers, SiteUsers and Users. I haven't worked with this particular webservice, but i think (i hope) that the webservice methods should do exactly the same. As someone explains in his blog post:
SPWeb.AllUsers – Gets the collection of user objects that represents all users who are either members of the site or who have browsed to the site as authenticated members of a domain group in the site
SPWeb.SiteUsers – Gets the collection of all users that belong to the site collection
SPWeb.Users – Gets the collection of user objects that are explicitly assigned permissions on the Web site
To get users explicitly for a web that has url http://sharepointserver/web/subweb call webservice from url http://sharepointserver/web/subweb/_vti_bin/usergroup.asmx If you want to use webservice in context of another web, then use that web's url and append /_vti_bin/usergroup.asmx
精彩评论