I want to create a doc, docx, pptx or excel file from C# direct to my Onedrive account. I have try this but it's not working for me. Anybody have any idea what I did wrong ? Thanks
public async Task<ActionResult> CreateWordFile()
{
LiveLoginResult loginStatus = await authClient.InitializeWebSessionAsync(HttpContext);
if (loginStatus.Status == LiveConnectSessionStatus.Connected)
{
var fileData = new Dictionary<string, object>();
fileData.Add("name", "Document.docx");
fileData.Add("Content-Type", "multipart/form-data; boundary=A300x");
fileData.Add("type", "file");
LiveOperationResult getResult = await connectedClient.PostAsync("me/skydrive/files", fileData);
}
return View();
}
EDITED: The error that I get is this one:
"The header 'Content-Type' is missing the required parameter: 'boundary'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Microsoft.Live.LiveConnectException: The header 'Content-Type' is missing the required parameter: 'boundary'."
A couple of things:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With