Microsoft Graph调用getPstnCalls接口top 10限制不生效问题咨询
问题:Microsoft Graph getPstnCalls接口的$top参数不生效
我尝试用以下Java(Groovy)代码调用Microsoft Teams的Graph通话记录getPstnCalls接口:
ClientSecretCredential credential = new ClientSecretCredentialBuilder().clientId(clientId).tenantId(tenantId).clientSecret(clientSecret).build() final GraphServiceClient graphClient = new GraphServiceClient(credential, scopes) var GetPstnCallsWithFromDateTimeWithToDateTimeGetResponse result = graphClient .communications() .callRecords() .microsoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTime(fromDate, toDate).get(requestConfiguration -> { requestConfiguration.queryParameters.top = 10 })
使用的Maven依赖为com.microsoft.graph:microsoft-graph:6.46.0,代码可正常运行,但返回所有通话记录,设置的top 10限制未生效。
我追踪了Microsoft组件代码,发现MicrosoftGraphCallRecordsGetPstnCallsWithFromDateTimeWithToDateTimeRequestBuilder类会将%24top(即URL编码后的$top)添加到查询参数中,该接口支持的参数包括count、filter、search、skip和top。最终生成的调用URL包含%24top=10参数(对应原生$top=10),且代码写法符合Microsoft官方示例。
但返回的result.odataCount数值为数百,result.odataNextLink为null,请问为何Microsoft Graph API不遵守$top=10的限制?
内容的提问来源于stack exchange,提问作者DavesPlanet
相关产品推荐
相关产品推荐

