I would like to ask how i can change file content on OneDrive. I'm using OneDrive SDK and when I'm trying change file Name it is working, but with Content I'm getting this error "Error getting value from 'ReadTimeout' on 'System.IO.MemoryStream'.
Here is my code - I'm just parsing string to stream...
StreamWriter writer = new StreamWriter(stream);
writer.Write("Hello word");
writer.Flush();
stream.Position = 0;
var updateItem = new Item { Name = txtNazev.Text+".txt", Content = stream };
var itemWithUpdates = await oneDriveClient
.Drive
.Items[Id]
.Request()
.UpdateAsync(updateItem);
You'll want to access the Content
property before calling Request()
, and then use PutAsync<Item>
instead of UpdateAsync
.
Take a look at this documentation for an example (note that it's a little different as it's accessing the item by path, but everything after that will be what you want).