c# - How to Download a Shared File on OneDrive for Business with the REST API? -
i trying download file shared folder appears in "shared me" folder of onedrive business. using following rest call folder name , files appear in it:
https://{tenant}-my.sharepoint.com/_api/search/query?querytext='(sharedwithusersowsuser:{useraccountname} , contentclass:sts_listitem_mysitedocumentlibrary)
and
https://{tenant}-my.sharepoint.com/_api/search/query?querytext='(parentlink:{parentlink})'
with no issues. metadata supplied these calls, files in each directory , tried downloading them using following request calls (note "user1" person downloading file, "user2" person shared file):
https://{tenant}-my.sharepoint.com/personal/user1_mydomain_com/_api/web/getfilebyserverrelativeurl('/personal/user2_mydomain_com/documents/test/test1.docx')/$value
or
https://{tenant}-my.sharepoint.com/_api/v1.0/user2_mydomain_com/files/{fileid}
i have attempted use new v2.0 calls, don't seem support "shared me" folder/file access yet.
in attempts, "bad request" or "not found" error when trying download shared file. have no issues downloading own onedrive business files using following rest call:
https://{tenant}-my.sharepoint.com/personal/user_mydomain_com/_api/web/getfilebyserverrelativeurl('/personal/user_mydomain_com/documents/user folder/test.htm')/$value
the calls using obtained from:
https://msdn.microsoft.com/office/office365/api/files-rest-operations (v1.0 calls)
https://dev.onedrive.com/readme.htm (v2.0 calls)
any advice appreciated. thanks!
Comments
Post a Comment