400 Error Adding OneDrive/Sharepoint

What is the problem you are having with rclone?

I'm trying to mount a Sharepoint drive via the site id option. I know the site id is correct as I can see drives, sets, and shares as possible drives to select form on the next menu, but after selecting any of these options I get a 400 error.

Failed to query root for drive "": HTTP error 400 (400 Bad Request) returned body: "{\"error\":{\"code\":\"invalidRequest\",\"message\":\"Invalid request\",\"innerError\":{\"date\":\"2023-10-13T03:31:31\",\"request-id\":\"fa47a10f-c659-4a85-a7ac-1e60697f9f4c\",\"client-request-id\":\"fa47a10f-c659-4a85-a7ac-1e60697f9f4c\"}}}"

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

rclone v1.64.0
- os/version: debian 12.0 (64 bit)
- os/kernel: 6.1.0-5-amd64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.21.1
- 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 -vv

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[box]
type = box
token = XXX

[onedrive test]
type = onedrive
token = XXX
drive_id = XXX
drive_type = business

[ssl]
type = onedrive
token = XXX
### Double check the config for sensitive info before posting publicly

A log from the command that you were trying to run with the -vv flag

Expand Log
[evan@blackbox ~] rclone config -vv
<7>DEBUG : rclone: Version "v1.64.0" starting with parameters ["rclone" "config" "-vv"]
<7>DEBUG : rclone: systemd logging support activated
<7>DEBUG : Using config file from "/home/evan/.config/rclone/rclone.conf"
Current remotes:

Name                 Type
====                 ====
box                  box
onedrive test        onedrive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n

Enter name for new remote.
name> ssl

Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
   \ (fichier)
 2 / Akamai NetStorage
   \ (netstorage)
 3 / Alias for an existing remote
   \ (alias)
 4 / Amazon Drive
   \ (amazon cloud drive)
 5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, Ceph, China Mobile, Cloudflare, GCS, DigitalOcean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Leviia, Liara, Lyve Cloud, Minio, Netease, Petabox, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Synology, Tencent COS, Qiniu and Wasabi
   \ (s3)
 6 / Backblaze B2
   \ (b2)
 7 / Better checksums for other remotes
   \ (hasher)
 8 / Box
   \ (box)
 9 / Cache a remote
   \ (cache)
10 / Citrix Sharefile
   \ (sharefile)
11 / Combine several remotes into one
   \ (combine)
12 / Compress a remote
   \ (compress)
13 / Dropbox
   \ (dropbox)
14 / Encrypt/Decrypt a remote
   \ (crypt)
15 / Enterprise File Fabric
   \ (filefabric)
16 / FTP
   \ (ftp)
17 / Google Cloud Storage (this is not Google Drive)
   \ (google cloud storage)
18 / Google Drive
   \ (drive)
19 / Google Photos
   \ (google photos)
20 / HTTP
   \ (http)
21 / Hadoop distributed file system
   \ (hdfs)
22 / HiDrive
   \ (hidrive)
23 / In memory object storage system.
   \ (memory)
24 / Internet Archive
   \ (internetarchive)
25 / Jottacloud
   \ (jottacloud)
26 / Koofr, Digi Storage and other Koofr-compatible storage providers
   \ (koofr)
27 / Local Disk
   \ (local)
28 / Mail.ru Cloud
   \ (mailru)
29 / Mega
   \ (mega)
30 / Microsoft Azure Blob Storage
   \ (azureblob)
31 / Microsoft OneDrive
   \ (onedrive)
32 / OpenDrive
   \ (opendrive)
33 / OpenStack Swift (Rackspace Cloud Files, Blomp Cloud Storage, Memset Memstore, OVH)
   \ (swift)
34 / Oracle Cloud Infrastructure Object Storage
   \ (oracleobjectstorage)
35 / Pcloud
   \ (pcloud)
36 / PikPak
   \ (pikpak)
37 / Proton Drive
   \ (protondrive)
38 / Put.io
   \ (putio)
39 / QingCloud Object Storage
   \ (qingstor)
40 / Quatrix by Maytech
   \ (quatrix)
41 / SMB / CIFS
   \ (smb)
42 / SSH/SFTP
   \ (sftp)
43 / Sia Decentralized Cloud
   \ (sia)
44 / Storj Decentralized Cloud Storage
   \ (storj)
45 / Sugarsync
   \ (sugarsync)
46 / Transparently chunk/split large files
   \ (chunker)
47 / Union merges the contents of several upstream fs
   \ (union)
48 / Uptobox
   \ (uptobox)
49 / WebDAV
   \ (webdav)
50 / Yandex Disk
   \ (yandex)
51 / Zoho
   \ (zoho)
52 / premiumize.me
   \ (premiumizeme)
53 / seafile
   \ (seafile)
Storage> 31

<7>DEBUG : ssl: config in: state="*all", result=""
<7>DEBUG : ssl: config out: out=&{State:*all-set,0,false Option: OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config: reading config parameter "client_id"
Option client_id.
OAuth Client Id.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_id>

<7>DEBUG : ssl: config in: state="*all-set,0,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,1,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,1,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all-set,1,false Option: OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config: reading config parameter "client_secret"
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret>

<7>DEBUG : ssl: config in: state="*all-set,1,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,2,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,2,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,3,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,3,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,4,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,4,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,5,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,5,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all-set,5,false Option:global OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config: reading config parameter "region"
Option region.
Choose national cloud region for OneDrive.
Choose a number from below, or type in your own string value.
Press Enter for the default (global).
 1 / Microsoft Cloud Global
   \ (global)
 2 / Microsoft Cloud for US Government
   \ (us)
 3 / Microsoft Cloud Germany
   \ (de)
 4 / Azure and Office 365 operated by Vnet Group in China
   \ (cn)
region> 1

<7>DEBUG : ssl: config in: state="*all-set,5,false", result="global"
<7>DEBUG : ssl: config out: out=&{State:*all,6,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,6,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,7,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,7,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,8,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,8,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,9,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,9,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,10,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,10,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,11,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,11,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,12,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,12,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,13,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,13,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,14,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,14,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,15,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,15,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,16,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,16,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,17,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,17,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,18,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,18,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,19,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,19,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,20,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,20,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,21,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,21,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all,22,false Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*all,22,false", result=""
<7>DEBUG : ssl: config out: out=&{State:*all-advanced Option:false OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config: reading config parameter "config_fs_advanced"
Edit advanced config?
y) Yes
n) No (default)
y/n>

<7>DEBUG : ssl: config in: state="*all-advanced", result="false"
<7>DEBUG : ssl: config out: out=&{State:*postconfig Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*postconfig", result=""
<7>DEBUG : ssl: config in: state="", result=""
<7>DEBUG : ssl: config out: out=&{State:*oauth,choose_type,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config out: out=&{State:*oauth,choose_type,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*oauth,choose_type,,", result=""
<7>DEBUG : ssl: config out: out=&{State:*oauth-confirm,choose_type,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*oauth-confirm,choose_type,,", result=""
<7>DEBUG : ssl: config out: out=&{State:*oauth-islocal,choose_type,, Option:true OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config: reading config parameter "config_is_local"
Use web browser to automatically authenticate rclone with remote?
 * Say Y if the machine running rclone has a web browser you can use
 * Say N if running rclone on a (remote) machine without web browser access
If not sure try Y. If Y failed, try N.

y) Yes (default)
n) No
y/n>

<7>DEBUG : ssl: config in: state="*oauth-islocal,choose_type,,", result="true"
<7>DEBUG : ssl: config out: out=&{State:*oauth-do,choose_type,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*oauth-do,choose_type,,", result=""
<7>DEBUG : Starting auth server on 127.0.0.1:53682
<5>NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=THiDSsF1GHK3PD4Mdc_FhQ
<5>NOTICE: Log in and authorize rclone for access
<5>NOTICE: Waiting for code...
<7>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+Sites.Read.All+offline_access&state=THiDSsF1GHK3PD4Mdc_FhQ
<7>DEBUG : Received GET request on auth server to "/"
<5>NOTICE: Got code
<7>DEBUG : Closing auth server
<7>DEBUG : Closed auth server with error: accept tcp 127.0.0.1:53682: use of closed network connection
<7>DEBUG : Saving config "token" in section "ssl" of the config file
<7>DEBUG : ssl: Saved new token in config file
<7>DEBUG : ssl: config out: out=&{State:*oauth-done,choose_type,, Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="*oauth-done,choose_type,,", result=""
<7>DEBUG : ssl: config out: out=&{State:choose_type Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="choose_type", result=""
<7>DEBUG : ssl: config out: out=&{State:choose_type_done Option:onedrive OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config: reading config parameter "config_type"
Option config_type.
Type of connection
Choose a number from below, or type in an existing string value.
Press Enter for the default (onedrive).
 1 / OneDrive Personal or Business
   \ (onedrive)
 2 / Root Sharepoint site
   \ (sharepoint)
   / Sharepoint site name or URL
 3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite
   \ (url)
 4 / Search for a Sharepoint site
   \ (search)
 5 / Type in driveID (advanced)
   \ (driveid)
 6 / Type in SiteID (advanced)
   \ (siteid)
   / Sharepoint server-relative path (advanced)
 7 | E.g. /teams/hr
   \ (path)
config_type> 6

<7>DEBUG : ssl: config in: state="choose_type_done", result="siteid"
<7>DEBUG : ssl: config out: out=&{State:siteid Option:<nil> OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config in: state="siteid", result=""
<7>DEBUG : ssl: config out: out=&{State:siteid_end Option: OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config: reading config parameter "config_siteid"
Option config_siteid.
Site ID
Enter a value.
config_siteid> 3bded61e-eaff-[redacted]

<7>DEBUG : ssl: config in: state="siteid_end", result="3bded61e-eaff-[redacted]"
<7>DEBUG : ssl: config out: out=&{State:driveid_final Option: OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config: reading config parameter "config_driveid"
Option config_driveid.
Select drive you want to use
Choose a number from below, or type in your own value.
 1 / drives ()
   \ ()
 2 / shares ()
   \ ()
 3 / sets ()
   \ ()
config_driveid> 1

<7>DEBUG : ssl: config in: state="driveid_final", result=""
<7>DEBUG : ssl: 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\":\"2023-10-13T03:31:31\",\"request-id\":\"fa47a10f-c659-4a85-a7ac-1e60697f9f4c\",\"client-request-id\":\"fa47a10f-c659-4a85-a7ac-1e60697f9f4c\"}}}" 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\":\"2023-10-13T03:31:31\",\"request-id\":\"fa47a10f-c659-4a85-a7ac-1e60697f9f4c\",\"client-request-id\":\"fa47a10f-c659-4a85-a7ac-1e60697f9f4c\"}}}"

<7>DEBUG : ssl: config in: state="choose_type", result=""
<7>DEBUG : ssl: config out: out=&{State:choose_type_done Option:onedrive OAuth:<nil> Error: Result:}, err=<nil>
<7>DEBUG : ssl: config: reading config parameter "config_type"
Option config_type.
Type of connection
Choose a number from below, or type in an existing string value.
Press Enter for the default (onedrive).
 1 / OneDrive Personal or Business
   \ (onedrive)
 2 / Root Sharepoint site
   \ (sharepoint)
   / Sharepoint site name or URL
 3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite
   \ (url)
 4 / Search for a Sharepoint site
   \ (search)
 5 / Type in driveID (advanced)
   \ (driveid)
 6 / Type in SiteID (advanced)
   \ (siteid)
   / Sharepoint server-relative path (advanced)
 7 | E.g. /teams/hr
   \ (path)
config_type>

Try choosing this type instead - I've had reports of users having better success with it.

 1 / OneDrive Personal or Business
   \ (onedrive)

I don't know if Microsoft have merged sharepoint with the onedrive business or something like that.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.