Microsoft Teams

What is the problem you are having with rclone?

It is not obvious how to setup a remote with access to Microsoft Teams Drives, as the following questions demonstrate. This post documents how I solved these issues.
(The "bug" is with the Forum settings: Topics expire after 60 days, so I can't post a complete answer on those questions, or link to appropriate answers. There is a discussion about this on the Discourse Meta site.)


What worked for me was to use the "search" option after authenticating via running the rclone authorize "onedrive" on a different computer were I was logged in to my Teams account. rclone configure went like this:

$ rclone config
name> ms_myteam
Storage> onedrive
...  # Blank client_id and client_secret. No advanced config.
Remote config...
y/n> n
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine:
	rclone authorize "onedrive"
Then paste the result below:          # Not sure when this will expire with MFA
result> {"access_token":..}
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   # This was the key.  Then search for something in you teams
What to search for> MyTeam      # NOTE: Don't use spaces here!
Found 2 sites, please select the one you want to use:
0: MyTeam (
Chose drive to use:> 0
Found 4 drives, please select the one you want to use:
0: Class Files (documentLibrary)...
1: Class Materials (documentLibrary)...
2: Documents (documentLibrary)...
Chose drive to use:> 2
Found drive 'root' of type 'documentLibrary', URL:
Is that okay?
y) Yes
n) No
y/n> y

I can then see everything in the team:

$ rclone ls ms_myteam:
  1864257 General/Videos/...

I am not sure how long this token will work as our organization uses MFA with a short time-out period. Does anyone have experience with this?

#### What is your rclone version (output from `rclone version`)
s$ rclone --version
rclone v1.48.0
- os/arch: linux/amd64
- go version: go1.12.6

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Linux (Ubuntu 20.04LTS)

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

Microsoft Teams through OneDrive

hello and welcome to the forum,

that version of rclone is years old.
should update to latest v1.55.0

With the latest version, there is one additional question:

Choose national cloud region for OneDrive.
Enter a string value. Press Enter for the default ("global").
Choose a number from below, or type in your own value
 1 / Microsoft Cloud Global
   \ "global"
 2 / Microsoft Cloud for US Government
   \ "us"
 3 / Microsoft Cloud Germany
   \ "de"
 4 / Azure and Office 365 operated by 21Vianet in China
   \ "cn"
region> global

and the number associated with searching changed:

Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Root Sharepoint site
   \ "sharepoint"
 3 / Sharepoint site name or URL (e.g. mysite or
   \ "url"
 4 / Search for a Sharepoint site
   \ "search"
 5 / Type in driveID (advanced)
   \ "driveid"
 6 / Type in SiteID (advanced)
   \ "siteid"
 7 / Sharepoint server-relative path (advanced, e.g. /teams/hr)
   \ "path"
Your choice> 4

I tried using the url option, but have not gotten that to work yet.

for url, i am able to use

Thanks for writing that up.

Do you want to contribute some of that to the onedrive docs?

If so go here and click the pencil icon.

It would be great to have a contribution while the solution is fresh in your mind.