【发布时间】:2021-12-10 14:55:09
【问题描述】:
是否可以知道组库中的项目数?
我尝试使用f'groups/{group["id"]}/drive',它会返回有关库的大量信息,但不包括文件总数。
编辑 (跟进 Popkornak 的回答)
我曾尝试使用$count 参数,但它不起作用。这是有和没有$count 的查询结果:
> print(requests.get('https://graph.microsoft.com/v1.0/groups/<group-id>/drive',
headers={'ConsistencyLevel': 'eventual', 'Authorization': '<...>'},
params={'$select': 'id', '$count': 'true'}).json())
{'error': {'code': 'invalidRequest', 'message': '$count is not supported on this API. Only URLs returned by the API can be used to page.', 'innerError': {'date': '2022-01-04T16:46:32', 'request-id': '<...>', 'client-request-id': '<...>'}}}
> print(requests.get('https://graph.microsoft.com/v1.0/groups/<group-id>/drive',
headers={'ConsistencyLevel': 'eventual', 'Authorization': '<...>'},
params={'$select': 'id'}).json())
{'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#drives(id)/$entity', 'id': '<...>'}
【问题讨论】:
标签: python sharepoint microsoft-graph-api