Create share link within the organization only

Hello, there.
I'm using OneDrive for business and can't figure out if rclone link supports an option to share across the organization only but not anonymous access with the link.

rclone link makes a public link normally.

        share := api.CreateShareLinkRequest{
                Type:  "view",
                Scope: "anonymous",
        }

I would guess it is possible to put something else in the scope to make different sorts of links, but rclone doesn't at the moment.

1 Like

Thanks, follows your clue I found that it is possible with the scope: organization.
So, we just need to rclone support it

We could add a flag to onedrive to set the scope of the shared links, say --ondrive-link-scope which could default to anonymous but be settable to organization too. We could also add a --onedrive-link-type flag which could be view|edit|embed

The rclone link command isn't quite flexible enough to take those extra parameters, though perhaps it should be reworked a little until it is.

Would you be willing to have a go at this? Or maybe your company would like to sponsor me to implement this?

This is more my personal issue as linux user so I would like to make a one-time donation :grinning:

I would rather see it additionally as config options so I can set it as default behavior to use rclone link without flags

Thank you for the donation :slight_smile:

I had a go with this

v1.54.0-beta.5041.6871bd4f8.fix-onedrive-link on branch fix-onedrive-link (uploaded in 15-30 mins)

    onedrive: enhance link creation with expiry, scope, type and password
    
    This change makes the --expire flag in `rclone link` work.
    
    It also adds the new flags
    
        --onedrive-link-type
        --onedrive-link-scope
        --onedrive-link-password

So quite a lot of changes, but all easy! Can you have a go with the flags and see if they work properly? I gave them a very brief test but knowing that the options work properly would be great. Note that not all of them work with all types of onedrive

--onedrive-link-scope

Set the scope of the links created by the link command.

  • Config: link_scope
  • Env Var: RCLONE_ONEDRIVE_LINK_SCOPE
  • Type: string
  • Default: "anonymous"
  • Examples:
    • "anonymous"
      • Anyone with the link has access, without needing to sign in. This may include people outside of your organization. Anonymous link support may be disabled by an administrator.
    • "organization"
      • Anyone signed into your organization (tenant) can use the link to get access. Only available in OneDrive for Business and SharePoint.

--onedrive-link-type

Set the type of the links created by the link command.

  • Config: link_type
  • Env Var: RCLONE_ONEDRIVE_LINK_TYPE
  • Type: string
  • Default: "view"
  • Examples:
    • "view"
      • Creates a read-only link to the item.
    • "edit"
      • Creates a read-write link to the item.
    • "embed"
      • Creates an embeddable link to the item. This option is only available for files in OneDrive personal.

--onedrive-link-password

Set the password for links created by the link command. OneDrive Personal only.

  • Config: link_password
  • Env Var: RCLONE_ONEDRIVE_LINK_PASSWORD
  • Type: string
  • Default: ""

Thanks for the update.
Tried it with --onedrive-link-scope organization --onedrive-link-type view works well for me.

Is there some kind of a short pattern for --expire like 1d instead of yyyy-MM-ddTHH:mm:ssZ?

Should work with Business too but only if chosen anonymous scope (I can set expire and password in web) but I failed with --onedrive-link-password "qwe"

./rclone link my-remote:/test1/test2 --onedrive-link-password "qwe"
invalidRequest: Invalid request
2021/01/07 15:27:20 Failed to link: invalidRequest: Invalid request

Great!

Yes, try --expire 1d :wink:

Oh, interesting. I copied the above from the API docs. I'll update the docs for that. I'll take out the caveats since the API gives error messages if you set the wrong thing.

I made a new beta here v1.54.0-beta.5041.1f68cb5d9.fix-onedrive-link on branch fix-onedrive-link (uploaded in 15-30 mins)

Do you think that is ready to merge now?

Update for the beta v1.54.0-beta.5041.d827c53a0.fix-onedrive-link on branch fix-onedrive-link (uploaded in 15-30 mins) (forgot to add the changes in the previous one!)

Works wtih ./rclone link my-remote:test1/test2 --onedrive-link-scope anonymous --onedrive-link-type view --expire 1d but still got error with --onedrive-link-password

./rclone link my-remote:test1/test2 -
-onedrive-link-scope anonymous --onedrive-link-type view --onedrive-link-password "qwe" --expire 1d -vvvvv
2021/01/07 18:15:13 DEBUG : rclone: Version "v1.54.0-beta.5041.d827c53a0.fix-onedrive-link" starting with parameters ["./rclone" "link" "my-remote:test1/test2"
"--onedrive-link-scope" "anonymous" "--onedrive-link-type" "view" "--onedrive-link-password" "qwe" "--expire" "1d" "-vvvvv"]
2021/01/07 18:15:13 DEBUG : Using config file from "/home/nikolay/.config/rclone/rclone.conf"
2021/01/07 18:15:13 DEBUG : Creating backend with remote "my-remote:test1/test2"
invalidRequest: Invalid request
2021/01/07 18:15:14 DEBUG : 5 go routines active
2021/01/07 18:15:14 Failed to link: invalidRequest: Invalid request

Hmm, can you use that combination on the web interface?

Can you try the request with -vv -dump bodies and see if it looks sensible? Maybe I messed up the API call...

Yep, I can do it in web

Here the dump, I just remove link to share and email

Summary

./rclone link my-remote:test1/test2 --onedrive-link-scope anonymous --onedrive-link-type view --onedrive-link-password "qwe" --expire 1d -vv --dump-bodies
2021/01/07 23:11:54 NOTICE: --dump-bodies is obsolete - please use --dump bodies instead
2021/01/07 23:11:54 DEBUG : rclone: Version "v1.54.0-beta.5041.d827c53a0.fix-onedrive-link" starting with parameters ["./rclone" "link" "my-remote:test1/test2" "--onedrive-link-scope" "anonymous" "--onedrive-link-type" "view" "--onedrive-link-password" "qwe" "--expire" "1d" "-vv" "--dump-bodies"]
2021/01/07 23:11:54 DEBUG : Using config file from "/home/nikolay/.config/rclone/rclone.conf"
2021/01/07 23:11:54 DEBUG : Creating backend with remote "my-remote:test1/test2"
2021/01/07 23:11:54 DEBUG : You have specified to dump information. Please be noted that the Accept-Encoding as shown may not be correct in the request and the response may not show Content-Encoding if the go standard libraries auto gzip encoding was in effect. In this case the body of the request will be gunzipped before showing it.
2021/01/07 23:11:54 DEBUG : my-remote: Loaded invalid token from config file - ignoring
2021/01/07 23:11:54 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2021/01/07 23:11:54 DEBUG : HTTP REQUEST (req 0xc00049d100)
2021/01/07 23:11:54 DEBUG : POST /common/oauth2/v2.0/token HTTP/1.1
Host: login.microsoftonline.com
User-Agent: rclone/v1.54.0-beta.5041.d827c53a0.fix-onedrive-link
Content-Length: 1136
Authorization: XXXX
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip

grant_type=refresh_token&refresh_token=0.ATwAipeaMt1gfUaLxc6UxF4ygdllVrGm7ZJAhTkO7Ddq_Vk8AO4.AgABAAAAAABeStGSRwwnTq2vHplZ9KL4AQDs_wMA9P9iMDE9SipWD57EmPJt8_pp8VlToynQhZQgWSL7KqP5-2F_1bTCqtjL0xYNdaGMl65QeWNl9KPZ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<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2021/01/07 23:11:55 DEBUG : HTTP RESPONSE (req 0xc00049d100)
2021/01/07 23:11:55 DEBUG : HTTP/1.1 200 OK
Content-Length: 3728
Cache-Control: no-store, no-cache
Content-Type: application/json; charset=utf-8
Date: Thu, 07 Jan 2021 20:11:38 GMT
Expires: -1
P3p: CP="DSP CUR OTPi IND OTRi ONL FIN"
Pragma: no-cache
Set-Cookie: fpc=At9AN0CZ9DhBrIrD-iYVCNJbIUgBAQAAAPphidcOAAAA; expires=Sat, 06-Feb-2021 20:11:38 GMT; path=/; secure; HttpOnly; SameSite=None
Set-Cookie: x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly
Set-Cookie: stsservicecookie=estsfd; path=/; secure; samesite=none; httponly
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Ms-Ests-Server: 2.1.11328.14 - NEULR1 ProdSlices
X-Ms-Request-Id: a63bfb16-c872-441c-b2a3-22ef82b16f01

{"token_type":"Bearer","scope":"Files.Read Files.Read.All Files.ReadWrite Files.ReadWrite.All profile openid email","expires_in":3599,"ext_expires_in":3599,"access_token":"eyJ0eXAiOiJKV1QiLCJub25jZSI6IkZfdU9ycnZpekR6cS1EeUFTTVJtUW9pVjZCUGRZT1dROUxWX19DY2tKUkkiLCJhbGciOiJSUzI1NiIsIng1dCI6IjVPZjlQNUY5Z0NDd0NtRjJCT0hIeEREUS1EayIsImtpZCI6IjVPZjlQNUY5Z0NDd0NtRjJCT0hIeEREUS1EayJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTAwMDAtYzAwMC0wMDAwMDAwMDAwMDAiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC8zMjlhOTc4YS02MGRkLTQ2N2QtOGJjNS1jZTk0YzQ1ZTMyODEvIiwiaWF0IjoxNjEwMDQ5OTk4LCJuYmYiOjE2MTAwNDk5OTgsImV4cCI6MTYxMDA1Mzg5OCwiY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<<<<<<
2021/01/07 23:11:55 DEBUG : my-remote: Saved new token in config file
2021/01/07 23:11:55 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2021/01/07 23:11:55 DEBUG : HTTP REQUEST (req 0xc0004f0000)
2021/01/07 23:11:55 DEBUG : GET /v1.0/drives/b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG/root HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.54.0-beta.5041.d827c53a0.fix-onedrive-link
Authorization: XXXX
Accept-Encoding: gzip

2021/01/07 23:11:55 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2021/01/07 23:11:56 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2021/01/07 23:11:56 DEBUG : HTTP RESPONSE (req 0xc0004f0000)
2021/01/07 23:11:56 DEBUG : HTTP/1.1 200 OK
Cache-Control: private
Client-Request-Id: 0ad5d63e-f321-4a89-aab3-79312ec0ff01
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Thu, 07 Jan 2021 20:11:39 GMT
Odata-Version: 4.0
Request-Id: 0ad5d63e-f321-4a89-aab3-79312ec0ff01
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"001","RoleInstance":"AGSFE_IN_21"}}

{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#drives('b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG')/root/$entity","createdDateTime":"2020-12-20T01:05:55Z","id":"01QGCTLKN6Y2GOVW7725BZO354PWSELRRZ","lastModifiedDateTime":"2021-01-07T09:05:41Z","name":"root","webUrl":"https://alphaopen-my.sharepoint.com/personal/kulakov_nikolay_alphaopen_com/Documents","size":13680538965,"parentReference":{"driveId":"b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG","driveType":"business"},"fileSystemInfo":{"createdDateTime":"2020-12-20T01:05:55Z","lastModifiedDateTime":"2021-01-07T09:05:41Z"},"folder":{"childCount":5},"root":{}}
2021/01/07 23:11:56 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2021/01/07 23:11:56 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2021/01/07 23:11:56 DEBUG : HTTP REQUEST (req 0xc0004f0500)
2021/01/07 23:11:56 DEBUG : GET /v1.0/drives/b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG/items/01QGCTLKN6Y2GOVW7725BZO354PWSELRRZ:/media: HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.54.0-beta.5041.d827c53a0.fix-onedrive-link
Authorization: XXXX
Accept-Encoding: gzip

2021/01/07 23:11:56 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2021/01/07 23:11:56 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2021/01/07 23:11:56 DEBUG : HTTP RESPONSE (req 0xc0004f0500)
2021/01/07 23:11:56 DEBUG : HTTP/1.1 200 OK
Cache-Control: private
Client-Request-Id: e529494a-a696-4053-921a-abbf8c742645
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Thu, 07 Jan 2021 20:11:39 GMT
Odata-Version: 4.0
Request-Id: e529494a-a696-4053-921a-abbf8c742645
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"001","RoleInstance":"AGSFE_IN_21"}}

{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#drives('b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG')/items/$entity","createdDateTime":"2020-12-25T07:55:30Z","eTag":""{0EBC6073-1E76-4342-8B33-0C2CF3AF910A},2"","id":"01QGCTLKLTMC6A45Q6IJBYWMYMFTZ27EIK","lastModifiedDateTime":"2020-12-25T07:55:30Z","name":"media","webUrl":"XXX","cTag":""c:{0EBC6073-1E76-4342-8B33-0C2CF3AF910A},0"","size":1524385234,"createdBy":{"user":{"email":"kulakov.nikolay@XXX","id":"750b9b0a-efb0-43ae-8376-ef737f7d0036","displayName":"\u041d\u0438\u043a\u043e\u043b\u0430\u0439 \u041a\u0443\u043b\u0430\u043a\u043e\u0432"}},"lastModifiedBy":{"user":{"email":"kulakov.nikolay@XXX","id":"750b9b0a-efb0-43ae-8376-ef737f7d0036","displayName":"\u041d\u0438\u043a\u043e\u043b\u0430\u0439 \u041a\u0443\u043b\u0430\u043a\u043e\u0432"}},"parentReference":{"driveId":"b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG","driveType":"business","id":"01QGCTLKN6Y2GOVW7725BZO354PWSELRRZ","path":"/drives/b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG/root:"},"fileSystemInfo":{"createdDateTime":"2020-12-25T07:55:30Z","lastModifiedDateTime":"2020-12-25T07:55:30Z"},"folder":{"childCount":2}}
2021/01/07 23:11:56 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2021/01/07 23:11:56 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2021/01/07 23:11:56 DEBUG : HTTP REQUEST (req 0xc00049d500)
2021/01/07 23:11:56 DEBUG : GET /v1.0/drives/b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG/items/01QGCTLKLTMC6A45Q6IJBYWMYMFTZ27EIK:/52.157: HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.54.0-beta.5041.d827c53a0.fix-onedrive-link
Authorization: XXXX
Accept-Encoding: gzip

2021/01/07 23:11:56 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2021/01/07 23:11:56 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2021/01/07 23:11:56 DEBUG : HTTP RESPONSE (req 0xc00049d500)
2021/01/07 23:11:56 DEBUG : HTTP/1.1 200 OK
Cache-Control: private
Client-Request-Id: 9fc35bd6-6576-47d0-9e45-6a9a7647a2ca
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Thu, 07 Jan 2021 20:11:39 GMT
Odata-Version: 4.0
Request-Id: 9fc35bd6-6576-47d0-9e45-6a9a7647a2ca
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"001","RoleInstance":"AGSFE_IN_21"}}

{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#drives('b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG')/items/$entity","createdDateTime":"2021-01-06T09:06:44Z","eTag":""{C5DF0382-C7C5-4D62-87CA-BDFAEC3AE056},1"","id":"01QGCTLKMCAPP4LROHMJGYPSV57LWDVYCW","lastModifiedDateTime":"2021-01-06T09:06:44Z","name":"52.157","webUrl":"XXX/52.157","cTag":""c:{C5DF0382-C7C5-4D62-87CA-BDFAEC3AE056},0"","size":1266894290,"createdBy":{"application":{"id":"b15665d9-eda6-4092-8539-0eec376afd59","displayName":"rclone"},"user":{"email":"kulakov.nikolay@XXX","id":"750b9b0a-efb0-43ae-8376-ef737f7d0036","displayName":"\u041d\u0438\u043a\u043e\u043b\u0430\u0439 \u041a\u0443\u043b\u0430\u043a\u043e\u0432"}},"lastModifiedBy":{"application":{"id":"b15665d9-eda6-4092-8539-0eec376afd59","displayName":"rclone"},"user":{"email":"kulakov.nikolay@XXX","id":"750b9b0a-efb0-43ae-8376-ef737f7d0036","displayName":"\u041d\u0438\u043a\u043e\u043b\u0430\u0439 \u041a\u0443\u043b\u0430\u043a\u043e\u0432"}},"parentReference":{"driveId":"b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG","driveType":"business","id":"01QGCTLKLTMC6A45Q6IJBYWMYMFTZ27EIK","path":"/drives/b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG/root:/media"},"fileSystemInfo":{"createdDateTime":"2021-01-06T09:06:44Z","lastModifiedDateTime":"2021-01-06T09:06:44Z"},"folder":{"childCount":2},"shared":{"scope":"users"}}
2021/01/07 23:11:56 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2021/01/07 23:11:56 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2021/01/07 23:11:56 DEBUG : HTTP REQUEST (req 0xc00049dc00)
2021/01/07 23:11:56 DEBUG : GET /v1.0/drives/b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG/root:/media/52.157/ HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.54.0-beta.5041.d827c53a0.fix-onedrive-link
Authorization: XXXX
Accept-Encoding: gzip

2021/01/07 23:11:56 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2021/01/07 23:11:57 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2021/01/07 23:11:57 DEBUG : HTTP RESPONSE (req 0xc00049dc00)
2021/01/07 23:11:57 DEBUG : HTTP/1.1 200 OK
Cache-Control: private
Client-Request-Id: 81177250-e019-4268-aa98-ac8a3d34aeb8
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
Date: Thu, 07 Jan 2021 20:11:39 GMT
Odata-Version: 4.0
Request-Id: 81177250-e019-4268-aa98-ac8a3d34aeb8
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"001","RoleInstance":"AGSFE_IN_21"}}

{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#drives('b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG')/root/$entity","createdDateTime":"2021-01-06T09:06:44Z","eTag":""{C5DF0382-C7C5-4D62-87CA-BDFAEC3AE056},1"","id":"01QGCTLKMCAPP4LROHMJGYPSV57LWDVYCW","lastModifiedDateTime":"2021-01-06T09:06:44Z","name":"52.157","webUrl":"XXX/52.157","cTag":""c:{C5DF0382-C7C5-4D62-87CA-BDFAEC3AE056},0"","size":1266894290,"createdBy":{"application":{"id":"b15665d9-eda6-4092-8539-0eec376afd59","displayName":"rclone"},"user":{"email":"kulakov.nikolay@XXX","id":"750b9b0a-efb0-43ae-8376-ef737f7d0036","displayName":"\u041d\u0438\u043a\u043e\u043b\u0430\u0439 \u041a\u0443\u043b\u0430\u043a\u043e\u0432"}},"lastModifiedBy":{"application":{"id":"b15665d9-eda6-4092-8539-0eec376afd59","displayName":"rclone"},"user":{"email":"kulakov.nikolay@XXX","id":"750b9b0a-efb0-43ae-8376-ef737f7d0036","displayName":"\u041d\u0438\u043a\u043e\u043b\u0430\u0439 \u041a\u0443\u043b\u0430\u043a\u043e\u0432"}},"parentReference":{"driveId":"b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG","driveType":"business","id":"01QGCTLKLTMC6A45Q6IJBYWMYMFTZ27EIK","path":"/drives/b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG/root:/media"},"fileSystemInfo":{"createdDateTime":"2021-01-06T09:06:44Z","lastModifiedDateTime":"2021-01-06T09:06:44Z"},"folder":{"childCount":2},"shared":{"scope":"users"}}
2021/01/07 23:11:57 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2021/01/07 23:11:57 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2021/01/07 23:11:57 DEBUG : HTTP REQUEST (req 0xc00025b100)
2021/01/07 23:11:57 DEBUG : POST /v1.0/drives/b!R6iB5wfZUUyPgoaN1kRpad0Bqmf-8TxGqyUqsy0XxXMObIGWjhguQ7uelu1IweLG/items/01QGCTLKMCAPP4LROHMJGYPSV57LWDVYCW/createLink HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.54.0-beta.5041.d827c53a0.fix-onedrive-link
Content-Length: 108
Authorization: XXXX
Content-Type: application/json
Accept-Encoding: gzip

{"type":"view","scope":"anonymous","password":"qwe","expirationDateTime":"2021-01-08T23:11:57.027093+03:00"}
2021/01/07 23:11:57 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2021/01/07 23:11:57 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2021/01/07 23:11:57 DEBUG : HTTP RESPONSE (req 0xc00025b100)
2021/01/07 23:11:57 DEBUG : HTTP/1.1 400 Bad Request
Content-Length: 283
Cache-Control: private
Client-Request-Id: 593caa0e-2183-4b58-b9b9-2ad137d30192
Content-Type: application/json
Date: Thu, 07 Jan 2021 20:11:40 GMT
Request-Id: 593caa0e-2183-4b58-b9b9-2ad137d30192
Strict-Transport-Security: max-age=31536000
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"West Europe","Slice":"SliceC","Ring":"5","ScaleUnit":"001","RoleInstance":"AGSFE_IN_21"}}

{
"error": {
"code": "invalidRequest",
"message": "Invalid request",
"innerError": {
"date": "2021-01-07T20:11:40",
"request-id": "593caa0e-2183-4b58-b9b9-2ad137d30192",
"client-request-id": "593caa0e-2183-4b58-b9b9-2ad137d30192"
}
}
}
2021/01/07 23:11:57 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
invalidRequest: Invalid request
2021/01/07 23:11:57 DEBUG : 7 go routines active
2021/01/07 23:11:57 Failed to link: invalidRequest: Invalid request

Hmm, I think this might be (as it says in the docs) onedrive personal only.

When I try a onedrive personal account I get

2021/01/08 09:12:25 DEBUG : HTTP REQUEST (req 0xc000400600)
2021/01/08 09:12:25 DEBUG : POST /v1.0/drives/71a96798e7b1d253/items/71A96798E7B1D253!431977/createLink HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.54.0-DEV
Content-Length: 79
Authorization: XXXX
Content-Type: application/json
Accept-Encoding: gzip

{"type":"view","scope":"anonymous","password":"akjhfgkjasdhfkjashfkjsah9879jk"}
2021/01/08 09:12:25 DEBUG : HTTP RESPONSE (req 0xc000400600)
2021/01/08 09:12:25 DEBUG : HTTP/1.1 403 Forbidden
Content-Length: 354
Cache-Control: private
Client-Request-Id: aa1b4559-97fd-428e-97f1-f4b801efaa2e
Content-Type: application/json
Date: Fri, 08 Jan 2021 09:12:25 GMT
Request-Id: aa1b4559-97fd-428e-97f1-f4b801efaa2e
Strict-Transport-Security: max-age=31536000
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"UK South","Slice":"SliceC","Ring":"3","ScaleUnit":"000","RoleInstance":"AGSFE_IN_10"}}

{
  "error": {
    "code": "accessDenied",
    "message": "Account Upgrade is required for this operation.",
    "innerError": {
      "code": "accountUpgradeRequired",
      "date": "2021-01-08T09:12:25",
      "request-id": "aa1b4559-97fd-428e-97f1-f4b801efaa2e",
      "client-request-id": "aa1b4559-97fd-428e-97f1-f4b801efaa2e"
    }
  }
}
accessDenied: accountUpgradeRequired: Account Upgrade is required for this operation.

Probably because I don't have a paid account.

When I try a business acount I get the same as you

2021/01/08 09:13:10 DEBUG : POST /v1.0/drives/b!tPczmrJTCE2ShO96VLAAn_DGv2_4eZJGl83N0OQe_t9LuHcGPileQ7YByS0_6_xp/items/01W3O4PFY2AVYOPAHVX5FIQSMKDRNLZJMG/createLink HTTP/1.1
Host: graph.microsoft.com
User-Agent: rclone/v1.54.0-DEV
Content-Length: 79
Authorization: XXXX
Content-Type: application/json
Accept-Encoding: gzip

{"type":"view","scope":"anonymous","password":"akjhfgkjasdhfkjashfkjsah9879jk"}
2021/01/08 09:13:10 DEBUG : HTTP RESPONSE (req 0xc000193c00)
2021/01/08 09:13:10 DEBUG : HTTP/1.1 400 Bad Request
Content-Length: 283
Cache-Control: private
Client-Request-Id: 18ead7ad-4674-417b-ab20-78cabbaf724e
Content-Type: application/json
Date: Fri, 08 Jan 2021 09:13:10 GMT
Request-Id: 18ead7ad-4674-417b-ab20-78cabbaf724e
Strict-Transport-Security: max-age=31536000
X-Ms-Ags-Diagnostic: {"ServerInfo":{"DataCenter":"UK South","Slice":"SliceC","Ring":"3","ScaleUnit":"000","RoleInstance":"AGSFE_IN_10"}}

{
  "error": {
    "code": "invalidRequest",
    "message": "Invalid request",
    "innerError": {
      "date": "2021-01-08T09:13:10",
      "request-id": "18ead7ad-4674-417b-ab20-78cabbaf724e",
      "client-request-id": "18ead7ad-4674-417b-ab20-78cabbaf724e"
    }
  }
}
invalidRequest: Invalid request

So I think rclone is supplying the correct things to the API but it doesn't work with business accounts which is documented in the API docs. Why it doesn't work in the API I don't know!

I did a bit of reading in the microsoft GitHub and it appears that the docs are correct.

I've merged where we've got to now which means it will be in the latest beta in 15-30 mins and released in v1.54

Ok, thank you, I think added functionality is fair enough to cover the topic case

1 Like

Thanks for testing :slight_smile: It is a nice feature.

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