0

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();
skobba
  • 1
  • 3

1 Answers1

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.

Mostafa
  • 3,296
  • 2
  • 26
  • 43
  • Yes, that should do if I can make it run on ASP .NET. Looks like this thread has some issues with that -> https://github.com/OneDrive/onedrive-sdk-csharp/issues/45. Ginach from MS says: "Authentication using client secret isn't fully implemented yet." (9 days ago). – skobba Jan 21 '16 at 23:44
  • the sdk includes a WinForms sample, but I have not been able to do this in an ASP .NET application. – skobba Feb 10 '16 at 17:32