问题
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