Open E3Solutions opened 7 years ago
Getting this error after the recent 2.0.7 update: Exception of type 'Microsoft.Graph.ServiceException' was thrown.
Code: // Create the excel file moExcelFile.SaveXls(tempfile); // Convert temp file to stream object Stream stream = new System.IO.FileStream(tempfile, System.IO.FileMode.Open);
string strOneDriveFileName = txtFileName.Text; string ext = Path.GetExtension(txtFileName.Text); if (String.IsNullOrEmpty(ext)) { strOneDriveFileName += ".xls"; } else { // Just remove whatever extension the user entered and append the correct extension. // This way we won't get any file type errors. strOneDriveFileName = strOneDriveFileName.Replace(ext, ""); strOneDriveFileName += ".xls"; } var targetFolder = this.CurrentOneDriveFolder; using (stream) { if (stream != null) { string folderPath = targetFolder.ParentReference == null ? "/drive/items/root:" : targetFolder.ParentReference.Path + "/" + Uri.EscapeUriString(targetFolder.Name); var uploadPath = folderPath + "/" + Uri.EscapeUriString(System.IO.Path.GetFileName(strOneDriveFileName)); try { ShowWork(true); var uploadedItem = await this.oneDriveClient.ItemWithPath(uploadPath).Content.Request().PutAsync<Item>(stream); AddItemToFolderContents(uploadedItem); ShowWork(false); } catch (Exception exception) { clsErrorHandler.LogException(exception, "", "", "ucOneDriveBrowser", "SaveExcelFileToOneDrive", "", 0, true); } } }
This has been working for quite a long without any issues. Now it seams a recent update has broken the PutAsync(stream) method.
I tried updating my solution to the latest version of the Microsoft.OneDrive.Sdk, but that did not work. Please advise.
I got the same issue when using the PutAsync method, but it works well if I manually create HTTP request. Please advise
Getting this error after the recent 2.0.7 update: Exception of type 'Microsoft.Graph.ServiceException' was thrown.
Code: // Create the excel file moExcelFile.SaveXls(tempfile); // Convert temp file to stream object Stream stream = new System.IO.FileStream(tempfile, System.IO.FileMode.Open);
This has been working for quite a long without any issues. Now it seams a recent update has broken the PutAsync- (stream) method.
I tried updating my solution to the latest version of the Microsoft.OneDrive.Sdk, but that did not work. Please advise.