public static void getWebFields(StreamWriter sw, WSSAuthentication.Authentication wssAuthentication, string url, string internalName) { LMD.ListCheck.WS_WebSvcWebs.Webs myservice = new LMD.ListCheck.WS_WebSvcWebs.Webs(); myservice.CookieContainer = wssAuthentication.CookieContainer; myservice.Url = url + "/_vti_bin/webs.asmx"; try { System.Xml.XmlNode nodes = myservice.GetColumns(); foreach (System.Xml.XmlNode node in nodes) { if (node.Name == "Field") { if (node.Attributes["Name"].Value == internalName) { sw.WriteLine("Url: " + url + ", Field SchemaXml: " + node.OuterXml); } } } } catch (Exception ex) { Console.Write(ex.Message); } }
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); } }