Thursday, August 23, 2012

How to get all SharePoint Users with web services in c#

SPservice.UserGroup usergroup = new SPservice.UserGroup();
usergroup.Credentials = System.Net.CredentialCache.DefaultCredentials;

XmlNode allusers = usergroup.GetAllUserCollectionFromWeb();

foreach (XmlNode child in allusers.ChildNodes) {
                            foreach (XmlNode item in child) {
                                  foreach (XmlAttribute atr in item.Attributes) {
                                              if (atr.Name.ToString() == "LoginName") {

SPservice - name of web reference in your visual studio project with URL:
http://<your server name>/_vti_bin/usergroup.asmx

No comments:

Post a Comment