예제 #1
0
        public static void enumerateListFields(StreamWriter sw, WSSAuthentication.Authentication wssAuthentication, string url, string listId, string listName)
        {
            string fieldTitle = String.Empty;
            LMD.ListCheck.WS_List.Lists myservice = new LMD.ListCheck.WS_List.Lists();
            myservice.CookieContainer = wssAuthentication.CookieContainer;
            myservice.Url = url + "/_vti_bin/lists.asmx";
            try
            {

                System.Xml.XmlNode nodes = myservice.GetList(listName);

                foreach (System.Xml.XmlNode node in nodes)
                {
                    if (node.Name == "Fields")
                    {
                        for (int i = 0; i < node.ChildNodes.Count; i++)
                        {
                            if (node.ChildNodes[i].Name == "Field")
                            {
                                fieldTitle = node.ChildNodes[i].Attributes["DisplayName"].Value;
                                sw.WriteLine("Url: " + url + ", List Title: " + listName + ", Field DisplayName: " + fieldTitle); //+ ", Field SchemaXml: " + node.ChildNodes[i].OuterXml);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
예제 #2
0
        public static void enumerateListPermissions(StreamWriter sw, WSSAuthentication.Authentication wssAuthentication, string url)
        {
            string listId = String.Empty;
            string listTitle = String.Empty;

            LMD.ListCheck.WS_List.Lists myservice = new LMD.ListCheck.WS_List.Lists();
            myservice.CookieContainer = wssAuthentication.CookieContainer;
            myservice.Url = url + "/_vti_bin/lists.asmx";

            sw.WriteLine("  List Permissions");

            try
            {

                System.Xml.XmlNode nodes = myservice.GetListCollection();

                foreach (System.Xml.XmlNode node in nodes)
                {
                    if (node.Name == "List")
                    {
                        listId = node.Attributes["ID"].Value;
                        listTitle = node.Attributes["Title"].Value;

                        if (listTitle != "Workflow Tasks" && listTitle != "Workflow History" && listTitle != "Documents" && listTitle != "Workflow Tasks" && listTitle != "Pages" && listTitle != "Master Page Gallery" && listTitle != "Images" && listTitle != "fpdatasources")
                        {
                            getListPermisions(sw, wssAuthentication, url, listTitle);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
예제 #3
0
        public static void enumerateListsInWeb(StreamWriter sw, WSSAuthentication.Authentication wssAuthentication, string url)
        {
            string listId = String.Empty;
            string listTitle = String.Empty;

            LMD.ListCheck.WS_List.Lists myservice = new LMD.ListCheck.WS_List.Lists();
            myservice.CookieContainer = wssAuthentication.CookieContainer;
            myservice.Url = url + "/_vti_bin/lists.asmx";

            XmlNode ndLists = myservice.GetListCollection();

            foreach (System.Xml.XmlNode node in ndLists)
            {
                //if (node.Name == "List")
                //{

                    listId = node.Attributes["ID"].Value;
                    listTitle = node.Attributes["Title"].Value;

                    //sw.WriteLine("Url: " + url + ", List Title: " + listTitle);

                    enumerateListFields(sw, wssAuthentication, url, listId, listTitle);

                //}
            }
        }
예제 #4
0
        public static void iterateThroughLists(StreamWriter sw, WSSAuthentication.Authentication wssAuthentication, string url, string internalName)
        {
            string listId = String.Empty;
            string listTitle = String.Empty;

            LMD.ListCheck.WS_List.Lists myservice = new LMD.ListCheck.WS_List.Lists();
            myservice.CookieContainer = wssAuthentication.CookieContainer;
            myservice.Url = url + "/_vti_bin/lists.asmx";

            XmlNode ndLists = myservice.GetListCollection();

            foreach (System.Xml.XmlNode node in ndLists)
            {
                if (node.Name == "List")
                {

                    listId = node.Attributes["ID"].Value;
                    listTitle = node.Attributes["Title"].Value;

                    getListFields(sw, wssAuthentication, url, listId, listTitle, internalName);

                }
            }
        }
예제 #5
0
        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);
            }
        }