$expand=permissions 失败,出现 notSupported 错误

$expand=permissions failed with notSupported error

documentation明确表示此端点支持$expand修改搜索结果:

users/{user-id}/drive/root/search(q='{search-text}')?$expand=permissions 

但是请求 returns 在其响应中包含以下正文:

{
    "error": {
        "code": "notSupported",
        "message": "The request is not supported by the system.",    
        "innerError": {
            "request-id": "30fc9988-6f4f-46ba-a5b4-91b150c4a1a5",     
            "date": "2017-11-17T02:30:49"
        }
    }
}

其他关系也是如此。尽管尝试扩展 createdByUser 结果是 BadRequest.

我们想做这个请求是为了避免做后续的请求。因为目前我们使用 SharePoint ListItemUniqueId(由于向后可比性)来查找相应的 DriveItem。然后我们要检索这个DriveItem的权限。但是现在我们需要做两个请求来实现这个。

我们也不能使用/users/{user-id}/drive/items,因为它不支持$filter

我们是对文档有误解还是这是 Microsoft Graph 方面的问题?

您无法展开 permissions 集合。来自 documentation:

The permissions relationship of DriveItem cannot be expanded as part of a call to get DriveItem or a collection of DriveItems. You must access the permissions property directly.

之所以$expand=createdByUserreturns一个BadRequest是因为默认已经展开了。

不支持的属性在 /search 端点的 $expand 中是:

  • children - 由于 /search returns 文件,这在逻辑上在这里没有任何意义。

  • lastModifiedByUser - 默认包含

  • content - 从逻辑上讲,将每个文件的内容包含在 DriveItems

  • 的集合中是没有意义的

但是可以展开缩略图 ($expand=thumbnails)。