问题
I am trying to provide one drive functionality in my winform application(.Net 3.5). I have successfully implemented this for one drive, but I am having trouble doing it for one drive for business. I have registered my application in azure and I am able to authenticate user, get the access token and tenant URL for logged in user. I am using the instructions provided on this [link]https://dev.onedrive.com/auth/aad_oauth.htm. When I try to access default drive it gives me unauthorized error. Here is my code to access the default drive.using(WebClient wc = new WebClient()) { wc.Headers[HttpRequestHeader.Authorization] = " Bearer " + acessToken; wc.DownloadString("https://<the tenant name>-my.sharepoint.com/_api/v2.0/me/drive/items" + "/drive"); } .
I have also tried "https://<the tenant name>-my.sharepoint.com/_api/v2.0/drive".
I also tried to access root folders items, but it is giving me the same error. I added
*"Windows Azure active Directory"
*"Office 365 unified API(preview)"
*"Office 365 SharePoint online"
*"Office 365 management API"
under the "delegation to other application" section and delegated all the permissions possible for these, while registering my app in azure. Is, there something else I need to do to access one drive for business?
回答1:
It's a API bug.
OneDrive for Business API item/file download content 401
I think they are working to fix this bug.
Thanks
来源:https://stackoverflow.com/questions/33038995/not-able-to-use-one-drive-api-for-one-drive-for-business