简体   繁体   English

如何使用图形 API 从 OneDrive 获取文件共享人员详细信息

[英]How to get the file shared persons details from OneDrive using graph API

I'm trying to read the permission details and the persons whom the file being shared in OneDrive.我正在尝试读取权限详细信息以及在 OneDrive 中共享文件的人员。 While checking the permission I get only the Manage Accessed persons details as "GrantedTo:" the rest showing like this.在检查权限时,我只获得“管理访问者”详细信息为“授予:” ,其余显示如下。

{
  "id": "89sd809e-a6fe-47cf-a563-d21fgac9fa3",
  "roles": [
    "read"
  ],
  "link": {
    "scope": "users",
    "type": "view",
    "webUrl": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  }
},

How can I get those persons details ?我怎样才能得到这些人的详细信息? Why the API returns grantedTo only for the managed access persons ?为什么 API 仅对受管访问人员返回 grantTo ?

The code that I tried :我试过的代码:

var permissionss = await graphClient.Me.Drive.Items["itemID"].Permissions
                        .Request(requestOptions)
                        .WithUserAccount(ClaimsPrincipal.Current.ToGraphUserAccount())
                        .GetAsync();

Please help me to find a solution.请帮我找到解决办法。

Thanks in advance提前致谢

Only the explicit permission for a user can be listed with person details.只有用户的明确权限才能与人员详细信息一起列出。

What is "explicit permission"?什么是“显式许可”? You can give this kind of permission like this:您可以像这样授予此类权限:

在此处输入图片说明

在此处输入图片说明

After granting access like this, the person details will be shown via /permissions endpoint.授予这样的访问权限后,人员详细信息将通过/permissions端点显示。

If you use other methods to share this file like this:如果您使用其他方法共享此文件,如下所示:

在此处输入图片说明

It actually just generates a sharing link.它实际上只是生成一个共享链接。 There is no specific audience who has been shared with this file.没有与此文件共享的特定受众。 People who have access to this file will be able to access it via this sharing link.有权访问此文件的人将能够通过此共享链接访问它。

So you can only get a sharing link "webUrl": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" in the response.所以你只能在响应中得到一个分享链接"webUrl": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

It is by-design of this Graph endpoint.这是此 Graph 端点的设计。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM