在图形Api中成功调用Invite之后,没有找到新的权限。

时间:2022-12-04 15:19:54

I am using Microsoft Graph to manipulate permissions of files that are stored in a SharePoint document library. When I use Invite to grant permission to an email address outside of the SharePoint site organization, I get a successful response that includes a permission ID.

我正在使用Microsoft Graph操作存储在SharePoint文档库中的文件的权限。当我使用邀请在SharePoint站点组织之外的电子邮件地址许可时,我获得了一个成功的响应,包括一个权限ID。

Looking at the permissions from SharePoint, I can see that it successfully created a share link for the provided email address that grants the requested permission. However, the permission does not appear in the list of permissions for that item when I query them using Microsoft Graph, and when I query the created permission using its ID, I get a NotFound response.

查看SharePoint的权限,我可以看到它成功地为所提供的授予请求权限的电子邮件地址创建了一个共享链接。但是,当我使用Microsoft Graph查询它们时,该项的权限列表中并没有出现权限,当我使用它的ID查询创建的权限时,我得到一个NotFound响应。

My goal is to access the sharing link webUrl of the permission, but the response returned when I first create it has a null 'link' facet and there does not appear to be any way to retrieve the permission after it has been created or to access sharing links for the file.

我的目标是访问的共享链接webUrl许可,但返回的响应时,我首先创建一个空的“链接”方面,似乎没有任何方式获取权限后创建或访问共享文件的链接。

Is this a bug or is there a way to access the sharing link for a permission granted to a file stored in a SharePoint document library?

这是一个bug还是有一种方法可以访问共享链接以获得存储在SharePoint文档库中的文件的权限?

Here are my steps:

这是我的步骤:

  1. POST /sites/{siteId}/drives/{driveId}/items/{itemId}/Invite with request body:

    POST /sites/{siteId}/drives/{driveId}/items/{itemId}/Invite with request body:

    {
      "requireSignIn": true,
      "sendInvitation": false,
      "roles": ["write"],
      "recipients": [{ "email": "{email}" }],
      "message": ""
    }
    
  2. Reponse (Success - Status Code 200):

    回复(成功-状态码200):

    {
      "@odata.context":
        "https://graph.microsoft.com/v1.0/$metadata#Collection(permission)",
      "value": [
        {
          "@odata.type": "#microsoft.graph.permission",
          "grantedTo": {
            "user": {
              "displayName": "{email}"
            }
          },
          "id": "{permissionId}",
          "roles": ["write"]
        }
      ]
    }
    
  3. I can verify from SharePoint that the permission was created for the email address and is associated with a specific sharing link

    我可以从SharePoint验证权限是为电子邮件地址创建的,并与特定的共享链接相关联

  4. GET /sites/{siteId}/drives/{driveId}/items/{itemId}/permissions/{permissionId}

    GET /网站/ { siteId } /硬盘/ { driveId } /项目/ { itemId } /权限/ { permissionId }

  5. Response (Failure - Status Code 404):

    响应(故障状态代码404):

    {
        "error": {
            "code": "itemNotFound",
            "message": "The resource could not be found.",
            "innerError": {
                "request-id": "f256c838-64fd-4679-b64f-7c62bf6ef178",
                "date": "2018-03-19T16:22:09"
            }
        }
    }
    
  6. Permission is also not listed when querying the list of permissions for that item

    当查询该项的权限列表时,也不列出权限

1 个解决方案

#1


0  

After some fiddling around myself, I found the solution. The permissions isn't actually granted until the recipient clicks the link and "accepts" the invitation.

我自己摸索了一会儿,找到了解决办法。直到接收方单击链接并“接受”邀请,才实际授予权限。

Try having your recipient click the link in the invitation and then check if you can find it.

试着让你的收件人在邀请函中点击链接,然后检查你是否能找到它。

Kind regards, R Schouten

亲切的问候,R思

#1


0  

After some fiddling around myself, I found the solution. The permissions isn't actually granted until the recipient clicks the link and "accepts" the invitation.

我自己摸索了一会儿,找到了解决办法。直到接收方单击链接并“接受”邀请,才实际授予权限。

Try having your recipient click the link in the invitation and then check if you can find it.

试着让你的收件人在邀请函中点击链接,然后检查你是否能找到它。

Kind regards, R Schouten

亲切的问候,R思