使用Microsoft图形客户端 sdk 您将如何使用搜索 Odata 查询



使用Microsoft Graph客户端sdk,如何使用搜索Odata查询来查找主题或正文是否包含某个搜索词。

$search Odata 查询参数在图形客户端 API 中可用,但我找不到如何使用该参数使用客户端 sdk for c#。

可以通过将QueryOptions列表传递给Request方法来添加任何查询参数。

List<QueryOption> options = new List<QueryOption>
{
new QueryOption("$search", "lunch")
};
var messages = await client.Me.Messages.Request(options).GetAsync();

文档:https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/docs/overview.md#custom-query-options

捎带@JohnStaurt上面的评论,这对我有用:

List<QueryOption> options = new List<QueryOption>
{
new QueryOption("$search", ""displayName:team" OR "description:team"")
};

最新更新