1

I want to get SPlist data using HTTPWebRequest but not sure how can i do it, here's the code I made until now,

                // Create a web request to get the xml feed
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(WEBURL);
            request.Method = "GET";
            request.Credentials = new NetworkCredential(_userName, _password);

            XmlDocument xml = null;
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            // If the request/response is successful
            if (response.StatusCode == HttpStatusCode.OK)
            {
                // Get the response stream containing the xml
                using (XmlTextReader reader = new XmlTextReader(response.GetResponseStream()))
                {}}

Cheers

  • 1
    what is your question anyway ;)? – Falak Mahmood May 16 '12 at 16:38
  • LOL question is, my code is half complete, and I dont know how to get the data using this XML reader lol – Muhammad Raja May 16 '12 at 20:20
  • 1
    Look at your tags! 2010/2007/list/xml/wtf? Which version of SharePoint are you actually using, 2007 or 2010? – Ryan May 17 '12 at 8:20
  • sorry, 2007 is what i am using – Muhammad Raja May 17 '12 at 9:58
0

I am not really sure what you're trying to do with that code but I'll make an attempt at guessing anyway.

If you're using SharePoint 2007 then the way to access list data via a 'http request' is using the SharePoint web services.

MSDN - HOW TO : Return List Items

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.