rclone: Can't use onedrive on business SharePoint doc library if I don't have read access to the document root
The associated forum post URL from https://forum.rclone.org
As per previous discussion: https://forum.rclone.org/t/cant-ls-onedrive-business-shared-folder-not-in-root-of-drive/19559
What is your current rclone version (output from rclone version)?
v1.57.0
What problem are you are trying to solve?
I’m trying to access a document library of a SharePoint site in my org. The doc library is set up so I don’t have access to list the root folder, only a special folder just for me a few levels deep. This is the same situation as described by someone else in the linked thread.
I can set it up ok, but I can’t list it with rclone: rclone lsd 'MySite:General/akdorsSpecialFolder' first tries to get MySite:General, which is the one I don’t have access to:
rclone -vvv --dump requests lsd 'MySite:General/akdorsSpecialFolder'
<7>DEBUG : GET /v1.0/drives/b!-[CENSORED]/root HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.57.0
Authorization: XXXX
Accept-Encoding: gzip
<7>DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<7>DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<7>DEBUG : HTTP RESPONSE (req 0xc000630200)
<7>DEBUG : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Cache-Control: no-cache
Client-Request-Id: [CENSORED]
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Tue, 25 Jan 2022 08:44:38 GMT
Odata-Version: 4.0
Request-Id: [CENSORED]
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"Australia Southeast","Slice":"E","Ring":"4","ScaleUnit":"002","RoleInstance":"[CENSORED]"}}
<7>DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<7>DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<7>DEBUG : HTTP REQUEST (req 0xc000576200)
<7>DEBUG : GET /v1.0/drives/b!-[CENSORED]/items/01[CENSORED]Z:/General: HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.57.0
Authorization: XXXX
Accept-Encoding: gzip
<7>DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<7>DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<7>DEBUG : HTTP RESPONSE (req 0xc000576200)
<7>DEBUG : HTTP/1.1 404 Not Found
Transfer-Encoding: chunked
Cache-Control: no-cache
Client-Request-Id: [CENSORED]
Content-Type: application/json
Date: Tue, 25 Jan 2022 08:44:37 GMT
Request-Id: [CENSORED]
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"Australia Southeast","Slice":"E","Ring":"4","ScaleUnit":"001","RoleInstance":"[CENSORED]"}}
How do you think rclone should be changed to solve that?
In the linked forum thread, and in comments in the source, it was explained that the traversal design was necessary to find children, as the graph API doesn’t allow getting the id of a driveitem directly by path. While this may have been true at the time, it sems to no longer be the case: I can use the Graph Explorer (https://developer.microsoft.com/en-us/graph/graph-explorer) to call
https://graph.microsoft.com/v1.0/drives/b!-[CENSORED]/root:/General/akdorsSpecialFolder
and I get a 200 response. So, maybe rclone doesn’t need to get children at every level from the root anymore? <-- hence, feature request 😃
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don’t comment if you have no relevant information to add. It’s just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 15 (7 by maintainers)
Commits related to this issue
- drive: add --drive-skip-dangling-shortcuts flag - fixes #5948 — committed to rclone/rclone by ncw 5 years ago
- onedrive: add --onedrive-root-folder-id flag #5948 This is to navigate to difficult to find folders in onedrive. — committed to rclone/rclone by ncw 5 years ago
- onedrive: add --onedrive-root-folder-id flag #5948 This is to navigate to difficult to find folders in onedrive. — committed to rclone/rclone by ncw 5 years ago
@ncw I’ve followed a recipe posted by @akdor1154 somewhere above in that thread: https://github.com/rclone/rclone/issues/5948#issuecomment-1030976537
In my case I’ve extracted following URL:
https://ifjedupl-my.sharepoint.com:443/_api/v2.0/drives/b!iyyUEFMz_kWTKjWfSP5ndNq_WW0CwMdIvttUlRwXsgsdVV6DxHKpT6aD8sXU1zSZ/items/016RGUGOWSHGSXEHLSIZGKWSVETOVWJIZA?version=PublishedThen I’ve extracted the part afteritemsaccording to the recipe, obtaining016RGUGOWSHGSXEHLSIZGKWSVETOVWJIZAOn the other hand running
rclone lsf --dirs-only --format ip --csvas @ncw suggested gives a bit different result:Switching from id
016RGUGOWSHGSXEHLSIZGKWSVETOVWJIZAtob!iyyUEFMz_kWTKjWfSP5ndNq_WW0CwMdIvttUlRwXsgsdVV6DxHKpT6aD8sXU1zSZ#016RGUGOWSHGSXEHLSIZGKWSVETOVWJIZAmakes rclone to work as expected:Maybe the instruction on how to obtain id of the folder in OneDrive should go somewhere into documentation ?
That seems to work, thankyou! Tested with recursive lsd and sync.
(For future googlers: finding the ID is kind of difficult - if you want to find the ID of
/folder/target, I got it by going to /folder in sharepoint with browser dev tools open, finding the RenderListDataAsStream network request, finding the children in the response, finding the child item that istarget, finding the.spItemUrlproperty, and extracting the bit of that url after/item/. It looks like a big 32 char hex string. There is also a UUID-format ID for the folder - this is all over the place in network requests, but it doesn’t work, you don’t want it 😦. )Would probably still consider this a feature request from user perspective, but the above does work as a workaround for this scenario. Thanks!
Do you know the ID of your folder?
It would be possible to get rclone to use the folder ID directly to access it.
Hmm, that is a potential speedup for all onedrive users
In theory a change like this would work
https://github.com/rclone/rclone/blob/0eb7b716d9a52af8859c85370465009af119644b/backend/onedrive/onedrive.go#L854-L863
Then the directory cache could be initialised with the root found directly rather than traversing the path.
https://github.com/rclone/rclone/blob/0eb7b716d9a52af8859c85370465009af119644b/backend/onedrive/onedrive.go#L694-L695
However
readMetaDataForPathuses the directory cache and I don’t think it will work as-is. It’s quite complicated too as it has to deal with shared folders and the differences between…@Cnly any thoughts about this?