listWebService.Lists listService = new listWebService.Lists();
            listService.Url = "http://emiliu:8081/team2/_vti_bin/Lists.asmx";
            listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
            
                    
            XmlDocument xmlDoc = new System.Xml.XmlDocument();
            XmlNode ndQuery = xmlDoc.CreateNode(XmlNodeType.Element, "Query", "");
          
            XmlNode ndQueryOptions = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", "");
            //We need to get count of items in dept1 folder
            //Please change folder name and library name according to your requirement
            ndQueryOptions.InnerXml = "<Folder>form_library_name/dept1</Folder>";
                     
            XmlNode ndListItems = listService.GetListItems("form_library_name", null, ndQuery, null, null, ndQueryOptions, null);
            System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
            xd.LoadXml(ndListItems.OuterXml);
            System.Xml.XmlNamespaceManager nm = new System.Xml.XmlNamespaceManager(xd.NameTable);
            
            nm.AddNamespace("rs", "urn:schemas-microsoft-com:rowset");
            nm.AddNamespace("z", "#RowsetSchema");
            nm.AddNamespace("rootNS", "http://schemas.microsoft.com/sharepoint/soap/");
            //This is the total count of items in dept1 folder
            int currentCount = xd.SelectNodes("/rootNS:listitems/rs:data/z:row", nm).Count;

 

posted on 2013-05-27 14:40  Liu_Liu  阅读(289)  评论(0编辑  收藏  举报