Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Access Sharepoint 2007 site data in .Net

$
0
0

I have been reading posts from khurj01asking similiar question but I am not able to find a solution to my problem.

how do i Access Sharepoint 2007 site data in .Net?  I have the following sample code but it generates an exception

       private void LoadLists()
        {
            webref.Lists listService = new webref.Lists();
            listService.Credentials =
                System.Net.CredentialCache.DefaultCredentials;
            listService.Url = "http://ambix.com/survey/_vti_bin/lists.asmx";

            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
            string listName = "{17991794-81BB-494F-9910-CFBF1093A7CF}";
            string viewName = "{7137FFF8-48FF-4C69-8C76-0E3BBD1EA7F9}";
            string rowLimit = "150";

            System.Xml.XmlElement query = xmlDoc.CreateElement("Query");
            System.Xml.XmlElement viewFields =
                xmlDoc.CreateElement("ViewFields");
            System.Xml.XmlElement queryOptions =
                xmlDoc.CreateElement("QueryOptions");

            query.InnerXml = "<Where><Gt><FieldRef Name=\"ID\" />" +
                "<Value Type=\"Counter\">3</Value></Gt></Where>";
            viewFields.InnerXml = "<FieldRef Name=\"Title\" />";
            queryOptions.InnerXml = "";

            System.Xml.XmlNode nodeListItems =
                listService.GetListItems
                (listName, viewName, query, viewFields, rowLimit, queryOptions, null);

            foreach (System.Xml.XmlNode listItem in nodeListItems)
            {
                label1.Text += listItem.OuterXml;
            }
        }


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>