0

I need some advice actually. I'm working on Aspose Words .NET and using that I created a PDF to my local system without any problem.

Here is the code I used to save the pdf doc:

doc.Save(savePath+"Myfile.pdf");

Now I want to save that pdf file directly to a Sharepoint folder using .Net, What should I do ? I have Sharepoint folder path, Username and Password as well, but couldn't find a right way to do it.

  • 2
    Does this answer your question? [How do you upload a file to a document library in sharepoint?](https://stackoverflow.com/questions/468469/how-do-you-upload-a-file-to-a-document-library-in-sharepoint) – MindSwipe Jun 27 '22 at 07:56
  • thanks for your quick reply @MindSwipe , but I'm asking that I don't want to use the local system, can we directly use aspose to save the pdf doc in sharepoint folder? – Suprateem Bose Jun 27 '22 at 09:08
  • 1
    You can save your aspose document to a `MemoryStream` and then use that stream to upload it to a sharepoint location. Be aware that that will use a lot of memory (a little more than the entire size of the document), so you should really only this with relatively small documents – MindSwipe Jun 27 '22 at 10:30

1 Answers1

1

There is no direct way to save document in a Sharepoint folder using Aspose.Words. To achieve this you should first save your document to a stream using Aspose.Words and then upload the resulting document in Sharepoint.

Alexey Noskov
  • 1,722
  • 1
  • 7
  • 13
  • Hi thanks for your answer , but can you please provide some code snippet to upload the `MemoryStream` document in Sharepoint? – Suprateem Bose Jun 27 '22 at 14:49
  • 1
    You can use the approach suggested by @MindSwipe. https://stackoverflow.com/questions/468469/how-do-you-upload-a-file-to-a-document-library-in-sharepoint Also here is another example https://social.technet.microsoft.com/Forums/azure/en-US/bc27a541-2ea3-4506-88a3-75dee4027f7d/how-to-upload-files-from-c-aspnet-to-sharepoint-online-library?forum=onlineservicessharepoint – Alexey Noskov Jun 28 '22 at 05:15