Rclone: Connect to shared OneDrive Folders
I use the rclone software a lot to syncronise my files across different remote sources, such as OneDrive, GDrive, SFTP, etc.
One issue I have encountered is that if somebody shares a folder with me, rclone is currently unable to connect to this folder if I haven’t added the folder as a link to my OneDrive root. For some folder this is fine, in that case I can connect to this folder as any other folder. Some folders I do not want to my OneDrive root, but still want to access them.
There is a workaround for this.
Setup your OneDrive remote as usual.
Open your
rclone.conf
file, and copy theaccess_token
for your remote. This will be a very long string. Only copyaccess_token
, do not copy copytoken_type
or any other tags.Make a request using
curl
to thehttps://graph.microsoft.com/v1.0/me/drive/sharedWithMe
endpoint from the Microsoft Graph API using your access token copied from the previous step, and save it to fileoutput.json
curl -H "Content-Type: application/json" -H "Authorization: bearer «access_token»" 'https://graph.microsoft.com/v1.0/me/drive/sharedWithMe' > output.json
If you have lots of files shared, then this file will be pretty big. Find the item you want added, and find the
id
in the path«item» > remoteItem > createdBy > user > id
Copy your OneDrive new entry in the
rclone.conf
file. Give it an appropriate name. Replace thedrive_id
with theid
you copied in the previous stepTest this new entry is working.