Access shared files in OneDrive for Business with Office 365 client libraries

假如想象 提交于 2019-12-12 02:40:06

问题


Is there a way to access shared files on OneDrive for Business with the Office 365 client libraries? There are many examples on how to access MyFiles, like this great one on github.

The Graph API has access through:

https://graph.microsoft.com/v1.0/drives/[DRIVEID]/items/[FOLDERID]/children

I have not found a way to access the same with the SharePointClient, only:

var filesResult = await client.Files.ExecuteAsync();

回答1:


There is a C# SDK for OneDrive for Business that you can use to pull user's files.

To get user's drive:

var drive = await oneDriveClient
                      .Drive
                      .Request()
                      .GetAsync();

To get the root folder files:

var rootItem = await oneDriveClient
                             .Drive
                             .Root
                             .Request()
                             .GetAsync();

Here is a GitHub Repo url:

https://github.com/onedrive/onedrive-sdk-csharp

Let me know if you have any questions.



来源:https://stackoverflow.com/questions/34910843/access-shared-files-in-onedrive-for-business-with-office-365-client-libraries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!