/// <summary> /// This method creates and uploads a file into a parent folder with a unique request /// </summary> /// <param name="driveId">The ID of the target drive</param> /// <param name="parentFolderId">The ID of the parent folder</param> /// <param name="file">The file object</param> /// <param name="content">The binary stream of the file content</param> /// <param name="contentType">The content type of the file</param> /// <returns>The just created and uploaded file object</returns> public static DriveItem UploadFileDirect(String driveId, String parentFolderId, DriveItem file, Stream content, String contentType) { var jsonResponse = MicrosoftGraphHelper.MakePutRequestForString( String.Format("{0}drives/{1}/items/{2}/children/{3}/content", MicrosoftGraphHelper.MicrosoftGraphV1BaseUri, driveId, parentFolderId, file.Name), content, contentType); var uploadedFile = JsonConvert.DeserializeObject <DriveItem>(jsonResponse); return(uploadedFile); }