We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Open document on server side (wss3.0)

I am trying to create a Document object that has a reference to a word doc file stored in a sharepoint list
(I want to run a mail merge on the server) The document is located at

http://servername:30585/MergeTemplates/SampleTemplate.doc

I have the following line of code

Document doc = new Document("http://servername:30585/MergeTemplates/SampleTemplate.doc");

I get the following exception
URI Paths are not supported…

Is there away around this… If not, any ideas on how I can run mail merge on documents stored on sharepoint lists?

Thank you

Hi

Thanks for your inquiry. You can use HttpWebRequest in this case. Please see the following code.

string url = "http://localhost/test\_setLicense/in.doc";
//Prepare the web page we will be asking for
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.ContentType = "application/msword";
request.UserAgent = "Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0";
//Execute the request
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
//We will read data via the response stream
Stream resStream = response.GetResponseStream();
//Write content into the MemoryStream
BinaryReader resReader = new BinaryReader(resStream);
MemoryStream docStream = new MemoryStream(resReader.ReadBytes((int)response.ContentLength));
//Create document
Document doc = new Document(docStream);
//Do something
//........
//Save document
doc.Save("out.doc");

Hope this helps.

Best regards.