By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,896 Members | 2,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,896 IT Pros & Developers. It's quick & easy.

Infopath docs

P: n/a
I have a question regarding Infopath and Sharepoint. We have a
sharepoint site set up with a few Infopath document libraries, how can
I open,modify, and save the Infopath documents stored therein?

Currently I have the following:

XmlDocument doc = new XmlDocument();
doc.Load("http://bomserver2:74/TestSharePoint/Library/0000.xml");

The Sharepoint site is returning a (401) Unathorized error when loading
the document. Of course I could set the Sharepoint site to allow
anonymous access to these libraries but that may not be the desired
solution. So I guess more specifically I need to know how to
propmatically specify user credentials when loading/saving xml
documents to Sharepoint. Hope I explained that thoroughly enough for
someone to be able to provide some help. Thanks

Sep 21 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I found the answer to my own question. I will post it here so others
who may be searching for this kind of info can find it.

loading the XML data:

XmlDocument doc = new XmlDocument();
HttpWebRequest req = (HttpWebRequest)WebRequest.
Create("http://bomserver2:74/TestSharePoint/Library/0000.xml");

req.Credentials = CredentialCache.DefaultNetworkCredentials;
Stream s = req.GetResponse().GetResponseStream();
XmlTextReader reader = new XmlTextReader(s);
doc.Load(reader);

// you now have an XML document that you can do with as you please
//saving the XML document back at the share point site requires
//installation of a custom web service however ... see
//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_sp2003_ta/html/odc_writingcustomwebservicesforsppt.asp
//
// After installing the sample web service and adding the web
//reference to your project one should be able to utillize
//the UploadDocument service after converting the
//XML contents into a byte array

string result = customService.UploadDocument("a.xml", byteArray,
"http://bomserver2:74/TestSharePoint/Library");
MessageBox.Show(result);

Sep 26 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.