-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uploading files using OneDriveLargeFileUploadTask with only the Files.ReadWrite.AppFolder permission is not possible #917
Comments
@chjohan This is an interesting use case that you have brought forward. Thank you! |
@chjohan Are you using a personal authentication token or a business/org account? That is, OneDrive for consumer or OneDrive for business? |
@nikithauc Personal authentication token. OneDrive for consumer. I have not tested with a business/org account. |
Hi @chjohan , The combined request would look something like: I am not very familiar with the SDK code, but looking at OneDriveLargeFileUploadTask.create(), it looks like it hardcodes the API path to something like /me/drive/root:/{file-path}:/createUploadSession, which will prevent you from using the 'special folder' addressing method. It seems like to work around this you'd need to replicate the logic in create() and createTaskWithFileObject(), but modify createTaskWithFileObject to use your own custom request URI instead of calling constructCreateSessionUrl(). @nikithauc - it would probably be helpful to include a way in the SDK to compose your own request URI here. Thanks, |
Thank you so much for your help @kevklam! @chjohan You can use the LargeFileTaskUpload instead which will help you to upload the file to OneDrive and you can customize the path. Please let me know if you have more questions. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
…com/microsoftgraph/msgraph-sdk-javascript into nikithauc/#917-uploadsession-custom
Fix released in v3.0.3 |
Bug Report
Prerequisites
For more information, see the
CONTRIBUTING
guide.Description
The name of the "Apps"-folder which is used when using the "Files.ReadWrite.AppFolder" permission is determined from the users' language. For english users the folder is named "Apps", bur for norwegian users the folder is named "Apper". As a consuquence it is very inpractical uploading files with "OneDriveLargeFileUploadTask", which requires you to supply the upload path when creating an upload session because, there is no way to get the name of the "Apps"-folder using only the "Files.ReadWrite.AppFolder"-permission.
For this you have to enable the Files.Read permission.
Console Errors: Not applicable.
Screenshots: [If applicable, add screenshots to help explain your problem]
Steps to Reproduce
Expected behavior: I either should be able to upload the file without knowing the name of the users "Apps" folder, or be allowed to get the name of the "Apps" folder, with the "Files.ReadWrite.AppFolder" permission, or be able to provide a path using the special/approot path format.
Actual behavior: "Apps"-folder does not exist when the target user has a different language than english, resulting in a 404.
Usage Information
Request ID - Value of the
requestId
field if you are receiving a Graph API error responseSDK Version - "@microsoft/microsoft-graph-client": "^3.0.2",
The text was updated successfully, but these errors were encountered: