Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

dataset ReadXML from SP document library xml file error

$
0
0

I have a requirement to read xml file stored in the document library into Dataset. For example,

dataset.ReadXML(@"C:\code\eventchart.xml") works just fine and my tool runs as well. However the .xml file is stored in a document library. I tried  to add URL as shown below but throws error "401 Unauthorized")

dataset.ReadXML("http://spsite/documentlibrary/eventchart.xml")

Note, I have already added SP reference. I tried objects using OM

using (SPSite spSite = new SPSite("http://spsite"))
{
  using (SPWeb spWeb = spSite.OpenWeb())
  {
     SPFolder workingFolder = spWeb.GetFolder("Documents");
     SPFile currFile = workingFolder.Files["eventchart.xml"];
     dataset.ReadXml(currFile.ToString());  
   }

}

Will you please help me to read xml url and assign to DataSet? I want exactly like this to work my application:

dataset.ReadXML("HTTP://spsite/documentlibrary/eventchart.xml")

Since this tool will be running on the server, I don't require client side object.

Appreciate your help on this!

Thanks

Shri


Viewing all articles
Browse latest Browse all 11571

Latest Images

Trending Articles



Latest Images

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