创建 OneDrive API

前往 Microsoft Azure 应用注册页面,点击新注册,名称随意,其他如下

获取 Client ID

获取 Client Secret

证书和密码 > 客户端密码 > 新客户端密码

设置权限

前往 API 权限 > 添加权限 > Microsoft Graph > 委托的权限 添加 Files.ReadFiles.ReadWriteFiles.Read.AllFiles.ReadWrite.Alloffline_access

配置 Rclone

安装

一行命令直接梭

curl https://rclone.org/install.sh | sudo shell

连接 Onedrive

rclone config
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n

Enter name for new remote.
name> od

Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
31 / Microsoft OneDrive
\ (onedrive)
Storage> 31

Option client_id.
OAuth Client Id.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_id> #上面的 Client ID

Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret> #上面的 Client Secret

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

Edit advanced config?
y) Yes
n) No (default)
y/n> n

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> n

Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
rclone authorize "onedrive" "" #复制这段命令到本地运行,会弹出浏览器要求授权
Then paste the result.
Enter a value.
config_token>
#得到的值粘贴到这里
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> 1

Option config_driveid.
Select drive you want to use
Choose a number from below, or type in your own string value.
Press Enter for the default ().
1 / User Photos (documentLibrary)
\ ()
2 / Organization Logos (documentLibrary)
\ ()
3 / OneDrive (business)
\ ()
config_driveid> 3

Drive OK?

Found drive "root" of type "business"
URL:

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

验证

touch test && rclone move test od:

迁移文件

重复上述步骤再添加一个 Onedrive

screen rclone copy od: od1: -P