onedrive: add support for no admin mode

Add tenant_url configuration option for accessing OneDrive/SharePoint
without admin privileges. When tenant_url is set, rclone uses the
SharePoint v2.0 API endpoint instead of the standard Microsoft Graph
API.

Co-Authored-By: KyokoMiki <161209740+kyokomiki@users.noreply.github.com>
This commit is contained in:
TaterLi
2026-05-19 11:21:17 +01:00
committed by Nick Craig-Wood
co-authored by KyokoMiki
parent 930a733594
commit 7bd05530eb
2 changed files with 76 additions and 2 deletions
+35
View File
@@ -237,6 +237,41 @@ credentials.
anyone with the *Client ID* and *Client Secret* can access your
OneDrive files. Take care to safeguard these credentials.
### Non-admin access to Business OneDrive
If you do not have admin access to your organization's OneDrive for
Business, you can still connect by manually providing the SharePoint
tenant URL and drive ID. This works by overriding the base API URL
from the standard Microsoft Graph endpoint to the SharePoint v2.0
endpoint.
#### Steps to manually obtain credentials
1. Open your browser and navigate to `https://[your-tenant].sharepoint.com/`
2. Open Developer Tools (press F12) and go to the **Network** tab.
3. Search for `driveAccessToken` in the network requests.
4. Extract the following information from the response:
```json
".driveUrl": "{tenant_url}/v2.0/drives/{drive_id}",
".driveAccessToken": "access_token={access_token}"
```
#### Rclone configuration
Use the extracted values to configure your remote:
```ini
type = onedrive
token = {"access_token":"{access_token}","token_type":"Bearer","refresh_token":"","expiry":"2045-12-31T23:59:59Z"}
drive_id = {drive_id}
tenant_url = {tenant_url}
drive_type = business
```
Since the exact expiry time cannot be determined from web traffic,
set the expiry to a future date. Note that the token will eventually
expire and you will need to repeat the process to obtain a new one.
### Modification times and hashes
OneDrive allows modification times to be set on objects accurate to 1