public static void getSiteColumn() { WSSAuthentication.Authentication _wssAuthentication = new WSSAuthentication.Authentication(); _wssAuthentication.Url = "https://www.niem.gov/_vti_bin/authentication.asmx"; _wssAuthentication.CookieContainer = new System.Net.CookieContainer(); _wssAuthentication.AllowAutoRedirect = true; WSSAuthentication.LoginResult login_result = _wssAuthentication.Login(_userName, _password); LMD.ListCheck.WS_WebSvcWebs.Webs webs = new LMD.ListCheck.WS_WebSvcWebs.Webs(); webs.CookieContainer = _wssAuthentication.CookieContainer; webs.Url = "https://www.niem.gov/_vti_bin/webs.asmx"; try { XmlNode myNode = webs.GetColumns(); //Create XML document. XmlDocument xmlDoc = new XmlDocument(); XmlNode d; d = xmlDoc.CreateXmlDeclaration("1.0", "", "yes"); xmlDoc.AppendChild(d); //Move Web service data into XML document and save. XmlNode root = xmlDoc.CreateElement("Fields"); root.InnerXml = myNode.InnerXml; xmlDoc.AppendChild(root); xmlDoc.Save("c:\\deploy\\SiteColumns.xml"); } catch (Exception ex) { Console.Write(ex.Message); } }
static void Main(string[] args) { string url = "https://www.niem.gov/"; //string url = "https://www.niem.gov/communities"; string internalName = "Category_x0020_Domains"; //string path = @"C:\deploy\niemoutput.txt"; string path = @"C:\source\enumeration.txt"; // This text is always added, making the file longer over time // if it is not deleted. using (StreamWriter sw = File.AppendText(path)) { sw.WriteLine("============================================================="); sw.WriteLine("Start run at " + DateTime.Now.ToString()); sw.WriteLine("Execute iterateThroughWebsEnumeratingLists"); sw.WriteLine("at " + url); sw.WriteLine(""); WSSAuthentication.Authentication _wssAuthentication = new WSSAuthentication.Authentication(); _wssAuthentication.Url = "https://www.niem.gov/_vti_bin/authentication.asmx"; _wssAuthentication.CookieContainer = new System.Net.CookieContainer(); _wssAuthentication.AllowAutoRedirect = true; WSSAuthentication.LoginResult login_result = _wssAuthentication.Login(_userName, _password); iterateThroughWebsEnumeratingLists(sw, _wssAuthentication, url); //iterateThroughWebsLookingAtPermissions(sw, _wssAuthentication, url); //getUserGroupsForSite(sw, _wssAuthentication, url); //getPermissionLevels(sw, _wssAuthentication, url); //getContentTypes(sw, _wssAuthentication, url); //getWebFields(sw, _wssAuthentication, url, internalName); //iterateThroughWebsLookingForSiteColumn(sw, _wssAuthentication, url, internalName); } }
public static void getListData() { WSSAuthentication.Authentication _wssAuthentication = new WSSAuthentication.Authentication(); _wssAuthentication.Url = "https://www.niem.gov/_vti_bin/authentication.asmx"; _wssAuthentication.CookieContainer = new System.Net.CookieContainer(); _wssAuthentication.AllowAutoRedirect = true; WSSAuthentication.LoginResult login_result = _wssAuthentication.Login(_userName, _password); LMD.ListCheck.WS_List.Lists myservice = new LMD.ListCheck.WS_List.Lists(); myservice.CookieContainer = _wssAuthentication.CookieContainer; myservice.Url = "https://www.niem.gov/aboutniem/_vti_bin/lists.asmx"; try { /* Assign values to pass the GetListItems method*/ string listName = "{64F28F78-8392-40CA-8EEE-3C09B4319EB5}"; string viewName = "{788D6C3B-218B-49B9-9FEE-540F110DE1FE}"; string rowLimit = "100"; // Instantiate an XmlDocument object System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); System.Xml.XmlElement query = xmlDoc.CreateElement("Query"); System.Xml.XmlElement viewFields = xmlDoc.CreateElement("ViewFields"); System.Xml.XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions"); /*Use CAML query*/ query.InnerXml = "<ViewFields Properties=\"True\" /><Where><Gt><FieldRef Name=\"ID\" />" + "<Value Type=\"Counter\">0</Value></Gt></Where>"; viewFields.InnerXml = "<FieldRef Name=\"Title\" /><FieldRef Name=\"Category Domains\" />"; queryOptions.InnerXml = ""; System.Xml.XmlNode nodes = myservice.GetListItems(listName, viewName, query, viewFields, rowLimit, null, null); foreach (System.Xml.XmlNode node in nodes) { if (node.Name == "rs:data") { for (int i = 0; i < node.ChildNodes.Count; i++) { if (node.ChildNodes[i].Name == "z:row") { if (node.ChildNodes[i].OuterXml.Contains("Category Domains")) { //getSiteColumn(); Console.Write(node.ChildNodes[i].Attributes["ows_Title"].Value + "</br>"); } } } } } } catch (Exception ex) { Console.Write(ex.Message); } }