1: using System;
2: using System.Collections.Generic;
3: using System.Text;
4: using System.Xml;
5: using Microsoft.SharePoint;
6: using Microsoft.SharePoint.Administration;
7: using ConsoleApplication2.localhost;
8: using ConsoleApplication2.UserInfoWS;
9:
10: namespace ConsoleApplication2
11: { 12: class Program
13: { 14: static void Main(string[] args)
15: { 16: UserInfoWS.UserGroup oUserGroup = new UserGroup();
17: oUserGroup.UseDefaultCredentials = true;
18: oUserGroup.Url = "http://blr3r07-19c/sites/mycollabsite/_vti_bin/usergroup.asmx";
19:
20: try
21: { 22: XmlNode ndUsers = oUserGroup.GetUserCollectionFromSite();
23:
24: string intUserID = "";
25: string strLoginName = "";
26:
27: XmlNodeList oNodes = ndUsers.ChildNodes;
28:
29: foreach (XmlNode node in oNodes)
30: { 31: XmlNodeReader objReader = new XmlNodeReader(node);
32:
33: while (objReader.Read())
34: { 35:
36: if (objReader["ID"] != null && objReader["LoginName"] != null)
37: { 38: intUserID = objReader["ID"].ToString();
39: strLoginName = objReader["LoginName"].ToString();
40: Console.WriteLine(intUserID.ToString() + "#;" + strLoginName);
41: }
42:
43: }
44:
45: }
46: }
47: catch (System.Web.Services.Protocols.SoapException ex)
48: { 49: Console.WriteLine("Message:\n" + ex.Message + "\nDetail:\n" + 50: ex.Detail.InnerText +
51: "\nStackTrace:\n" + ex.StackTrace);
52: }
53: Console.ReadLine();
54: }
55: }
56: }
57: