【发布时间】:2021-07-26 12:57:23
【问题描述】:
我按照此页面设置了 MicrosoftGraphProvider:http://www.keithmsmith.com/get-started-microsoft-graph-api-calls-net-core-3/
这工作正常,因为我能够通过以下请求获得所有用户的列表。
var user = await _graphServiceClient.Users.Request().GetAsync();
但是,我并不总是希望所有用户都返回,因此我通过电子邮件过滤了用户。
示例说明这样做
var user = await _graphServiceClient.Users[email].Request().GetAsync();
但这总是导致找不到用户,即使我从所有用户的回复中传递了一封有效的电子邮件。
所以我尝试构建一个过滤器,并这样做。
var test = await _graphServiceClient.Users["$filter=startswith(mail,'test@email.com')"].Request().GetAsync();
var test = await _graphServiceClient.Users["$filter=(startswith(mail,'test@email.com'))"].Request().GetAsync();
这两个都返回了错误:
Status Code: BadRequest
Microsoft.Graph.ServiceException: Code: BadRequest
Message: The $filter path segment must be in the form $filter(expression), where the expression resolves to a boolean.
当我在 Postman 中直接调用 url 时,这个过滤器可以正常工作。但我正在尝试使用他们的 sdk,但它没有按预期工作。
这个过滤查询有什么问题?
【问题讨论】:
-
你可以有一个look here
标签: c# asp.net microsoft-graph-api microsoft-graph-sdks