小编man*_*ghu的帖子

Graph API 搜索 $filter 中的特殊字符

下面是代码。如果我传递搜索参数的搜索值,例如:M'test。它抛出错误。

使用此代码支持“'”等特殊字符的正确方法是什么?

var graphClient = await GetGraphClient();
List<QueryOption> queryOptions = new List<QueryOption>();
queryOptions.Add(new QueryOption("$filter", string.Format("startswith(displayName,'{0}')", search)));
var collection = await graphClient.Data.Request(queryOptions).GetAsync();
Run Code Online (Sandbox Code Playgroud)

c# filter special-characters odata microsoft-graph-api

4
推荐指数
1
解决办法
1499
查看次数