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.conffile, and copy theaccess_tokenfor your remote. This will be a very long string. Only copyaccess_token, do not copy copytoken_typeor any other tags.Make a request using
curlto thehttps://graph.microsoft.com/v1.0/me/drive/sharedWithMeendpoint from the Microsoft Graph API using your access token copied from the previous step, and save it to fileoutput.jsoncurl -H "Content-Type: application/json" -H "Authorization: bearer «access_token»" 'https://graph.microsoft.com/v1.0/me/drive/sharedWithMe' > output.jsonIf you have lots of files shared, then this file will be pretty big. Find the item you want added, and find the
idin the path«item» > remoteItem > createdBy > user > idCopy your OneDrive new entry in the
rclone.conffile. Give it an appropriate name. Replace thedrive_idwith theidyou copied in the previous stepTest this new entry is working.