I want to write in MemoryStream and then put/ upload the same in Shared documents in Sharepoint Below is the code I am trying:-
var clientContext = new ClientContext("https://server.info/");
string fileUrl = "/Shared Documents/NewDocumentFromTemplate.txt";
var ms = new MemoryStream();
using (var file = new StreamWriter(ms))
{
file.WriteLine("Wrinting in file");
}
Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, fileUrl, ms, true);
Its actually creating a new file as NewDocumentFromTemplate.txt but it is empty. Its not writing anything. :(
Actuallly I want to create a file on fly and then upload it in share point.
Please help I am first time working with Share Point client.