rclone: Can't connect to SharePoint Online team sites such as https://orgname.sharepoint.com/sites/Site-Name

I’ve been able to successfully connect to the default https://orgname-my.sharepoint.com/ personal SharePoint Site…

$ rclone lsd sp3:
-1 2017-01-04 22:16:34         0 Attachments
-1 2015-01-23 11:13:10         0 Shared with Everyone

But I’m having difficultly figuring out how to connect to team sites on URLs such a: https://orgname.sharepoint.com/sites/Site-Name etc.

The “rclone config” guided process doesn’t let you set the resource_url when setting it up. So I’ve tried editing ~/.config/rclone.conf using a few different methods, changing the resource_url and then reauthorizing, I’ve tried a number of different addresses like…

For the main/default team site:

https://orgname.sharepoint.com/ 
https://orgname.sharepoint.com/Shared Documents

For separate team sites, or what Microsoft call “site collections”:

https://orgname.sharepoint.com/sites/Site-Name
https://orgname.sharepoint.com/sites/Site-Name/
https://orgname.sharepoint.com/sites/Site-Name/Shared Documents
https://orgname.sharepoint.com/sites/Site-Name/Shared Documents/
https://orgname.sharepoint.com/sites/Site-Name/Shared%20Documents
https://orgname.sharepoint.com/sites/Site-Name/Shared%20Documents/

I’m not sure which address format I’m meant to use? (for either the main team site, or all the other ones under /sites/)

I always get the error:

$ rclone -vv lsd sp3:
2017/10/25 03:17:18 DEBUG : Using config file from "/home/user/.config/rclone/rclone.conf"
2017/10/25 03:17:18 DEBUG : rclone: Version "v1.38" starting with parameters ["rclone" "-vv" "lsd" "sp3:"]
2017/10/25 03:17:19 Failed to create file system for "sp3:": failed to get root: 401 Unauthorized: 

(there’s nothing after that last colon)

Does anyone know how I access team SharePoint sites?

My rclone version is:

rclone v1.38
- os/arch: linux/amd64
- go version: go1.9

…on Manjaro 64bit, installed from the distro’s repos.

I’m choosing the “business” option when asked in rclone config.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 86 (39 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve merged @telepath 's fix for this to master now which means it will be in the latest beta in 15-30 mins and released in v1.51

One can lookup site ID manually by using https://developer.microsoft.com/graph/graph-explorer/ and login with default permissions. After that she will be able to lookup site by name with request like https://graph.microsoft.com/v1.0/sites/mysite.sharepoint.com:/sites/my-team and received ID can be used by rclone.

To provide a bit more detail:

  • Go to the Microsoft Graph Explorer and sign in with your account (the pane on the left says something about “you’re currently using a sample account”)
  • Query https://graph.microsoft.com/v1.0/sites/mysite.sharepoint.com:/sites/my-team, substituting in your own site URL (for mysite.sharepoint.com) and site name (for my-team). Your site name is apparent in the URL when you’re simply browsing your team SharePoint site
  • Copy and paste the “id” returned in the response as the “siteid” in the rclone config

One can lookup site ID manually by using https://developer.microsoft.com/graph/graph-explorer/ and login with default permissions. After that she will be able to lookup site by name with request like https://graph.microsoft.com/v1.0/sites/mysite.sharepoint.com:/sites/my-team and received ID can be used by rclone.

Don’t see any particular reason why rclone can’t lookup site my-team by it’s name in the same way.

But anyway thanks for the current implementation. Please let me know if I can help you with test(s).

Hello,

I’ve had a hard time setting up a remote to my university sharepoint site. The default config procedure only offered my university-provided personal OneDrive, upecnumerique-my.sharepoint.com/personal/[mail address], but not the Sharepoint site, upecnumerique.sharepoint.com/sites/[name]. The Graph Explorer gave no result with keyword “upecnumerique”.

I opened the Sharepoint site HTML source code and looked for IDs. Given the above comment https://github.com/ncw/rclone/issues/1770#issuecomment-360477464 and some trial-and-error, I found the ID is upecnumerique.sharepoint.com,[siteId],[webId] (I tested this by inserting the ID in request https://graph.microsoft.com/v1.0/sites/[ID]/drive/root/children as advised above).

The sharepoint site “contains” many folders. I thought rclone config would add the site as a remote, but instead each folder is seen as a drive and I have to choose only one among the 57 of them 😕 Fortunately I only need 4 of them, so I can cope with 4 separate remotes.

Thank you for the great software.

@mkoegel wrote:

Version 1.41 should support SharePoint via webdav, but the docu is not updated yet. Did someone get this to run?

You can find the docs here: https://rclone.org/webdav/#sharepoint

@heerohawwah Those “DEBUG : Couldn’t decode error response: EOF” messages mean that the remote end returned an HTTP error rather than an XML Webdav error most likely. You can ignore them - they aren’t important.

I wonder if the “Failed to copy: object not found” errors are caused by the rclone uploading the file, then going to check it but finding it isn’t there yet due to some eventual consistency stuff.

If you retry the sync, does it clean up any it missed OK?

The above did not work for me for some reason. The search however worked great!

As above go to the MS Graph Explorer and authenticate.

Then get the siteID by searching part of the site name with the below url: https://graph.microsoft.com/v1.0/sites?search={your query} Finally use option 4 to add the site and paste the id there.


There is a bug in the search in rclone:

Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Root Sharepoint site
   \ "sharepoint"
 3 / Type in driveID
   \ "driveid"
 4 / Type in SiteID
   \ "siteid"
 5 / Search a Sharepoint site
   \ "search"
Your choice> 5
What to search for> xxx000
2020/01/08 16:10:30 Failed to query available sites: HTTP error 403 (403 Forbidden) returned body: "{\r\n  \"error\": {\r\n    \"code\": \"accessDenied\",\r\n    \"message\": \"The caller does not have permission to perform the action.\",\r\n    \"innerError\": {\r\n      \"request-id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\r\n      \"date\": \"2020-01-08T16:10:30\"\r\n    }\r\n  }\r\n}"

If you do it manually via the Graph API it works and returns the siteID in the id field.

I can confirm partial reading/writing from rclone to my 365 sharepoint site using webdav. It did require the latest rclone beta with the updated QuickXorHash @ncw.

The URL syntax: https://<your-dm>.sharepoint.com/sites/<your-site>/Shared%20Documents

I am however getting lots of IO errors and object not found errors during a copy or sync.

2018/05/02 08:51:47 ERROR : : Failed to copy: object not found 2018/05/02 08:51:47 ERROR : : Failed to copy: object not found 2018/05/02 08:51:48 ERROR : webdav root ‘’: not deleting files as there were IO errors 2018/05/02 08:51:48 ERROR : webdav root ‘’: not deleting directories as there were IO errors 2018/05/02 08:51:48 ERROR : Attempt 1/3 failed with 6 errors and: object not found

Edit: However the ‘failed to copy’ files do actually get copied and are intact on the sharepoint site.

I was going to try using OneDrive in rclone instead of WebDav but don’t know how to change the Resource URL in the rclone OneDrive config to target the sharepoint site rather than the personal drive…

New consent ist required.

@ncw I have a corporate sharepoint site. The docu only shows the OneDrive for Business case. My URL is something like https://<org>.sharepoint.com/sites/<site#>/Shared%20Documents/ That was also the original topic for this issue by @hi2u. @dienal-san also asked about this above.

Version 1.41 should support SharePoint via webdav, but the docu is not updated yet. Did someone get this to run? I use the URL https://<org>.sharepoint.com/sites/<site#>/Shared%20Documents/ and my user/pw, but get a 403 couldn’t list files.

The link in that comment has a version for Linux 64Bit and Windows 64 Bit

If you click his link above, there is an exe there as well that may work for you.