Posted on

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.

  1. Setup your OneDrive remote as usual.

  2. Open your rclone.conf file, and copy the access_token for your remote. This will be a very long string. Only copy access_token, do not copy copy token_type or any other tags.

  3. Make a request using curl to the https://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 file output.json

    curl -H "Content-Type: application/json" -H "Authorization: bearer «access_token»" 'https://graph.microsoft.com/v1.0/me/drive/sharedWithMe' > output.json
  4. 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

  5. Copy your OneDrive new entry in the rclone.conf file. Give it an appropriate name. Replace the drive_id with the id you copied in the previous step

  6. Test this new entry is working.

comments powered by Disqus