首页 文章

应用$ filter选项在Graph API中检索具有特定名称的文件夹

提问于
浏览
1

以下过滤器子句在Graph Explorer中不起作用

https://graph.microsoft.com/v1.0/drives?$ filter = name eq 'Documents'

过滤器的应用是否有任何限制,因为指定的过滤器是根据OData协议

1 回答

  • 0

    OneDrive API(以及驱动器上的Graph API)不支持过滤或排序结果 . 当Microsoft Graph看到它不期望的查询参数时,它只是忽略未知的过滤器参数并返回未经过滤的结果 . drives api支持$ expand,$ select,$ skipToken,$ top和$ orderby(orderby不起作用)OData查询参数来自定义响应 .

    我的测试数据:https://graph.microsoft.com/v1.0/drives?$ filter = name eq 'Documents' / $ filter = driveType eq 'documentLibrary'“:

    {
        "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
        "value": [
            {
                "createdDateTime": "2018-06-04T07:32:28Z",
                "description": "List of all app packages uploaded in the Dev Site",
                "id": "b!NEuoD0E0IkyGzigmyNtKyXtJFUgDWoBJhM2BFIAvNsp69o2q1-czTaV6INjgi_dk",
                "lastModifiedDateTime": "2018-06-05T04:19:59Z",
                "name": "App Packages",
                "webUrl": "https://xxxx.sharepoint.com/Lists/AppPackages",
                "driveType": "documentLibrary",
                "createdBy": {
                    "user": {
                        "displayName": "System Account"
                    }
                },
                "quota": {
                    "deleted": 0,
                    "remaining": 0,
                    "total": 0,
                    "used": 0
                }
            } 
        ]
    }
    

相关问题