Rclone cannot detect Sharepoint

What is the problem you are having with rclone?

When trying to connect to a Sharepoint, it cannot be found using rclone. Tried with both URL and SiteID.
Background: I'm only invited as an external user and the site seems to be a tenant of a tenant.

Run the command 'rclone version' and share the full output of the command.

rclone v1.58.1
- os/version: debian 11.4 (64 bit)
- os/kernel: 5.10.0-14-amd64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17.9
- go/linking: static
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Sharepoint

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone config

The rclone config contents with secrets removed.

[sharepoint]
type = onedrive
token = {"access_token":"xxxxxx"}

A log from the command with the -vv flag

2022/07/12 13:33:54 DEBUG : rclone: Version "v1.58.1" starting with parameters ["rclone" "-vv" "config"]
2022/07/12 13:33:54 DEBUG : Using config file from "/Users/macadmin/.config/rclone/rclone.conf"
2022/07/12 13:34:11 DEBUG : sharepoint: config in: state="*all", result=""
2022/07/12 13:34:11 DEBUG : sharepoint: config out: out=&{State:*all-set,0,false Option: OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:11 DEBUG : sharepoint: config: reading config parameter "client_id"
2022/07/12 13:34:23 DEBUG : sharepoint: config in: state="*all-set,0,false", result=""
2022/07/12 13:34:23 DEBUG : sharepoint: config out: out=&{State:*all,1,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:23 DEBUG : sharepoint: config in: state="*all,1,false", result=""
2022/07/12 13:34:23 DEBUG : sharepoint: config out: out=&{State:*all-set,1,false Option: OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:23 DEBUG : sharepoint: config: reading config parameter "client_secret"
2022/07/12 13:34:25 DEBUG : sharepoint: config in: state="*all-set,1,false", result=""
2022/07/12 13:34:25 DEBUG : sharepoint: config out: out=&{State:*all,2,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:25 DEBUG : sharepoint: config in: state="*all,2,false", result=""
2022/07/12 13:34:25 DEBUG : sharepoint: config out: out=&{State:*all,3,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:25 DEBUG : sharepoint: config in: state="*all,3,false", result=""
2022/07/12 13:34:25 DEBUG : sharepoint: config out: out=&{State:*all,4,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:25 DEBUG : sharepoint: config in: state="*all,4,false", result=""
2022/07/12 13:34:25 DEBUG : sharepoint: config out: out=&{State:*all,5,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:25 DEBUG : sharepoint: config in: state="*all,5,false", result=""
2022/07/12 13:34:25 DEBUG : sharepoint: config out: out=&{State:*all-set,5,false Option:global OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:25 DEBUG : sharepoint: config: reading config parameter "region"
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all-set,5,false", result="global"
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,6,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,6,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,7,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,7,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,8,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,8,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,9,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,9,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,10,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,10,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,11,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,11,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,12,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,12,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,13,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,13,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,14,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,14,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,15,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,15,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,16,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,16,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,17,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,17,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,18,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,18,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all,19,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config in: state="*all,19,false", result=""
2022/07/12 13:34:28 DEBUG : sharepoint: config out: out=&{State:*all-advanced Option:false OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:28 DEBUG : sharepoint: config: reading config parameter "config_fs_advanced"
2022/07/12 13:34:29 DEBUG : sharepoint: config in: state="*all-advanced", result="false"
2022/07/12 13:34:29 DEBUG : sharepoint: config out: out=&{State:*postconfig Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:29 DEBUG : sharepoint: config in: state="*postconfig", result=""
2022/07/12 13:34:29 DEBUG : sharepoint: config in: state="", result=""
2022/07/12 13:34:29 DEBUG : sharepoint: config out: out=&{State:*oauth,choose_type,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:29 DEBUG : sharepoint: config out: out=&{State:*oauth,choose_type,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:29 DEBUG : sharepoint: config in: state="*oauth,choose_type,,", result=""
2022/07/12 13:34:29 DEBUG : sharepoint: config out: out=&{State:*oauth-confirm,choose_type,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:29 DEBUG : sharepoint: config in: state="*oauth-confirm,choose_type,,", result=""
2022/07/12 13:34:29 DEBUG : sharepoint: config out: out=&{State:*oauth-islocal,choose_type,, Option:true OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:29 DEBUG : sharepoint: config: reading config parameter "config_is_local"
2022/07/12 13:34:30 DEBUG : sharepoint: config in: state="*oauth-islocal,choose_type,,", result="true"
2022/07/12 13:34:30 DEBUG : sharepoint: config out: out=&{State:*oauth-do,choose_type,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:34:30 DEBUG : sharepoint: config in: state="*oauth-do,choose_type,,", result=""
2022/07/12 13:34:30 DEBUG : Starting auth server on 127.0.0.1:53682
2022/07/12 13:34:30 NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=d-Zuz3Im1LLcn-dEnKZbHQ
2022/07/12 13:34:30 NOTICE: Log in and authorize rclone for access
2022/07/12 13:34:30 NOTICE: Waiting for code...
2022/07/12 13:34:43 DEBUG : Redirecting browser to: https://login.microsoftonline.com/common/oauth2/v2.0/authorize?access_type=offline&client_id=b15665d9-eda6-4092-8539-0eec376afd59&redirect_uri=http%3A%2F%2Flocalhost%3A53682%2F&response_type=code&scope=Files.Read+Files.ReadWrite+Files.Read.All+Files.ReadWrite.All+offline_access+Sites.Read.All&state=d-Zuz3Im1LLcn-dEnKZbHQ
2022/07/12 13:35:11 DEBUG : Received GET request on auth server to "/"
2022/07/12 13:35:11 NOTICE: Got code
2022/07/12 13:35:11 DEBUG : Closing auth server
2022/07/12 13:35:11 DEBUG : Closed auth server with error: accept tcp 127.0.0.1:53682: use of closed network connection
2022/07/12 13:35:12 DEBUG : Saving config "token" in section "sharepoint" of the config file
2022/07/12 13:35:12 DEBUG : sharepoint: Saved new token in config file
2022/07/12 13:35:12 DEBUG : sharepoint: config out: out=&{State:*oauth-done,choose_type,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:35:12 DEBUG : sharepoint: config in: state="*oauth-done,choose_type,,", result=""
2022/07/12 13:35:12 DEBUG : sharepoint: config out: out=&{State:choose_type Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:35:12 DEBUG : sharepoint: config in: state="choose_type", result=""
2022/07/12 13:35:12 DEBUG : sharepoint: config out: out=&{State:choose_type_done Option:onedrive OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:35:12 DEBUG : sharepoint: config: reading config parameter "config_type"
2022/07/12 13:35:33 DEBUG : sharepoint: config in: state="choose_type_done", result="url"
2022/07/12 13:35:33 DEBUG : sharepoint: config out: out=&{State:url Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:35:33 DEBUG : sharepoint: config in: state="url", result=""
2022/07/12 13:35:33 DEBUG : sharepoint: config out: out=&{State:url_end Option: OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:35:33 DEBUG : sharepoint: config: reading config parameter "config_site_url"
2022/07/12 13:37:08 DEBUG : sharepoint: config in: state="url_end", result="https://bertelsmann.sharepoint.com/sites/bportal_cc_xxxxxx"
2022/07/12 13:37:08 DEBUG : sharepoint: config out: out=&{State:choose_type Option:<nil> OAuth:<nil> Error:Failed to query available site by relative path: HTTP error 500 (500 Internal Server Error) returned body: "{\"error\":{\"code\":\"InternalServerError\",\"message\":\"Unable to find target address\",\"innerError\":{\"date\":\"2022-07-12T11:37:08\",\"request-id\":\"745cbc3f-11e8-449b-aed4-d4e2d388a2a0\",\"client-request-id\":\"745cbc3f-11e8-449b-aed4-d4e2d388a2a0\"}}}" Result:}, err=<nil>
Failed to query available site by relative path: HTTP error 500 (500 Internal Server Error) returned body: "{\"error\":{\"code\":\"InternalServerError\",\"message\":\"Unable to find target address\",\"innerError\":{\"date\":\"2022-07-12T11:37:08\",\"request-id\":\"745cbc3f-11e8-449b-aed4-d4e2d388a2a0\",\"client-request-id\":\"745cbc3f-11e8-449b-aed4-d4e2d388a2a0\"}}}"
2022/07/12 13:37:08 DEBUG : sharepoint: config in: state="choose_type", result=""
2022/07/12 13:37:08 DEBUG : sharepoint: config out: out=&{State:choose_type_done Option:onedrive OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:37:08 DEBUG : sharepoint: config: reading config parameter "config_type"
2022/07/12 13:37:23 DEBUG : sharepoint: config in: state="choose_type_done", result="siteid"
2022/07/12 13:37:23 DEBUG : sharepoint: config out: out=&{State:siteid Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:37:23 DEBUG : sharepoint: config in: state="siteid", result=""
2022/07/12 13:37:23 DEBUG : sharepoint: config out: out=&{State:siteid_end Option: OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:37:23 DEBUG : sharepoint: config: reading config parameter "config_siteid"
2022/07/12 13:37:49 DEBUG : sharepoint: config in: state="siteid_end", result="0fa97ca5-03ab-4e55-b7d3-xxxxxxxxxxxxx"
2022/07/12 13:37:49 DEBUG : sharepoint: config out: out=&{State:driveid_final Option: OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:37:49 DEBUG : sharepoint: config: reading config parameter "config_driveid"
2022/07/12 13:37:56 DEBUG : sharepoint: config in: state="driveid_final", result=""
2022/07/12 13:37:57 DEBUG : sharepoint: config out: out=&{State:choose_type Option:<nil> OAuth:<nil> Error:Failed to query root for drive "": HTTP error 400 (400 Bad Request) returned body: "{\"error\":{\"code\":\"invalidRequest\",\"message\":\"Invalid request\",\"innerError\":{\"date\":\"2022-07-12T11:37:57\",\"request-id\":\"a7a1c89f-4d80-4ce9-9ccd-a9f56632c650\",\"client-request-id\":\"a7a1c89f-4d80-4ce9-9ccd-a9f56632c650\"}}}" Result:}, err=<nil>
Failed to query root for drive "": HTTP error 400 (400 Bad Request) returned body: "{\"error\":{\"code\":\"invalidRequest\",\"message\":\"Invalid request\",\"innerError\":{\"date\":\"2022-07-12T11:37:57\",\"request-id\":\"a7a1c89f-4d80-4ce9-9ccd-a9f56632c650\",\"client-request-id\":\"a7a1c89f-4d80-4ce9-9ccd-a9f56632c650\"}}}"
2022/07/12 13:37:57 DEBUG : sharepoint: config in: state="choose_type", result=""
2022/07/12 13:37:57 DEBUG : sharepoint: config out: out=&{State:choose_type_done Option:onedrive OAuth:<nil> Error: Result:}, err=<nil>
2022/07/12 13:37:57 DEBUG : sharepoint: config: reading config parameter "config_type"

I actually receive the same errors when trying to access the site using Microsoft Graph. Everything works fine using a webbrowser.

This sounds like one of those very complicated Microsoft auth problems which I know nothing about :frowning:

You could try accessing it via webdav which sometimes works better (or the next section in the docs also).

I thought so as well, but as guest I cannot create an app-password. I will check if the provider could provide one...

1 Like