[英]filter is not working when using Microsoft Graph API to List Groups with Teams
I'm using Powershell, running multiple Graph API are fine.我正在使用 Powershell,运行多个图形 API 很好。 trying to get list of groups with teams by following below Doc:
尝试通过以下文档获取包含团队的组列表:
https://docs.microsoft.com/en-us/graph/teams-list-all-teams?context=graph%2Fapi%2F1.0&view=graph-rest-1.0 https://docs.microsoft.com/en-us/graph/teams-list-all-teams?context=graph%2Fapi%2F1.0&view=graph-rest-1.0
$uri = "https://graph.microsoft.com/beta/groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team')"
$groups = GetGraphData($uri,$headerParams)
the response is same like I didn't use the filter, still including all of groups which resourceProvisioningOptions is not 'Team', so it seems not working.响应与我没有使用过滤器一样,仍然包括所有 resourceProvisioningOptions 不是“团队”的组,所以它似乎不起作用。
$uri = "https://graph.microsoft.com/beta/groups"
is there any mistake when above $uri string combined?上面的 $uri 字符串组合有什么错误吗? on /Any(x:x eq 'Team')
on /Any(x:x eq '团队')
Most likely your filter expression is ignored since PowerShell tries to expand $
into a variable.由于 PowerShell 尝试将
$
扩展为变量,因此很可能会忽略您的过滤器表达式。 A dollar sign needs to be escaped, in Powershell with "`" (backward apostrophe/grave) character:美元符号需要转义,在 Powershell 中带有“`”(后撇号/坟墓)字符:
$uri = "https://graph.microsoft.com/beta/groups?`$filter=resourceProvisioningOptions/Any(x:x eq 'Team')"
Alternately use single quotes '
instead of double quotes "
:交替使用单引号
'
而不是双引号"
:
$uri = 'https://graph.microsoft.com/beta/groups?$filter=resourceProvisioningOptions/Any(x:x eq ''Team'')'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.