Load document from sharepoint

Hi,
I have the product Aspose words, and I want to load a word document from SharePoint library.
How can I do it?

Hi Naomi,

Thanks for your inquiry. You need to download Word document into stream or file path and then can load the document into Aspose.Words.

Best Regards,

Can you please write an example how to download Word document from share point into stream ?

Hi Naomi,

Thanks for your inquiry. You may google for sample code to load word document from SharePoint server into stream. You will find a lot of solutions for your requirement.

Best Regards,

Please help me to find, I can’t find an example

Hi Naomi,

Thanks for your feedback. Please check following documentation link, it reads the email message from SharePoint Document Library. You can use same code to read word document form SharePoint Document Library. Hopefully it will help you to accomplish the task.

Furthermore, there are other helpful links for reading documents from SharePoint Server.

Best Regards,

Hi,
I loaded the document to stream, below it the code, but I get an error that the file is cupurated

Microsoft.SharePoint.Client.ClientContext context = new Microsoft.SharePoint.Client.ClientContext("http://rmiportaltest.mami.gov.il/teams/AgafMeida/Michrazim/");

// Open the web
var web = context.Web;

// var docs = web.Lists.GetByTitle("Pirsum");
// var fileName = docs.RootFolder.Files.GetByUrl("http://rmiportaltest.mami.gov.il/teams/AgafMeida/Michrazim/Pirsum/Pirsum20160001-806.docx");
var docs = web.Lists.GetByTitle("testDavid3");
var fileName = docs.RootFolder.Files.GetByUrl("http://rmiportaltest.mami.gov.il/teams/AgafMeida/Michrazim/testDavid3/aaa.docx");

Microsoft.SharePoint.Client.ClientResult stream1 = fileName.OpenBinaryStream();
context.ExecuteQuery();
Aspose.Words.License license = new Aspose.Words.License();
license.SetLicense("Aspose.Words.lic");
Document doc = new Document(stream1.Value);
doc.Save(@"c:\work\a.pdf");

Hi Naomi,

Thanks for your inquiry. Please set stream position to 0 before loading it into Document object, it will resolve the issue. Furthermore, you can save your stream to disk to double check whether it contains correct data.

Best Regards,