使用Office 365客户端库访问OneDrive for Business中的共享文件 [英] Access shared files in OneDrive for Business with Office 365 client libraries

查看:121
本文介绍了使用Office 365客户端库访问OneDrive for Business中的共享文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Office 365客户端库访问OneDrive for Business上的共享文件?关于如何访问MyFile的例子很多,例如很棒的一个在github上.

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.

Graph API可以通过以下方式访问:

The Graph API has access through:

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

我还没有找到一种通过SharePointClient访问相同内容的方法,

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

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

推荐答案

有一个用于OneDrive for Business的C#SDK,可用于提取用户文件.

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();

要获取根文件夹文件:

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

这是GitHub Repo网址:

Here is a GitHub Repo url:

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

如果您有任何疑问,请告诉我.

Let me know if you have any questions.

这篇关于使用Office 365客户端库访问OneDrive for Business中的共享文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆