如何通过userType = null筛选用户? [英] How to filter users by userType = null?

查看:77
本文介绍了如何通过userType = null筛选用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的Graph查询中过滤出Guest个用户.由于不支持ne比较运算符,因此我尝试使用$filter=userType eq 'Member' or userType eq null.那也失败了.是否有任何已知的解决方法将null列为userType的用户列出?

I am trying to filter out Guest users in my Graph query. Since the ne comparison operator is not supported I was trying $filter=userType eq 'Member' or userType eq null instead. That fails too though. Any known workarounds to list users with null as userType?

没有,我每次都需要下载大约一百万行,并在客户端中将5个中的4个扔掉,这是非常缓慢且浪费的.

Without that I need to download about a million rows each time and throw 4 out of 5 away on the client side, which is pretty slow and wasteful.

{
"error": {
    "code": "Request_UnsupportedQuery",
    "message": "Unsupported or invalid query filter clause specified for property 'userType' of resource 'User'.",
    "innerError": {
        "request-id": "411f7927-c3af-4042-a619-eee1c88971a0",
        "date": "2018-03-17T18:28:35"
    }
}

推荐答案

作为一般经验法则,userType应该为MemberGuest.例外是在同步本地Active Directory时.由于userType是Azure AD属性,因此已同步用户的值将为null.

As a general rule of thumb, userType should be either Member or Guest. The exception to this is when you're syncing an on-prem Active Directory. Since userType is an Azure AD property, the value for a synced user will be null.

如果您可以放心地认为本地用户不是来宾,则可以基于Azure AD用户的同步对象或本地用户来对其进行过滤.您可以通过查看onPremisesSyncEnabled属性来执行此操作.对于已同步的用户,此名称为true,对于本地云用户,其名称为null.

If you can safely assume that your on-prem users are not guests, you can filter Azure AD user's based on if they're synced or cloud-native. You do this by looking at the onPremisesSyncEnabled property. For synced users, this will be true, for cloud-native users it will be null.

如果将此属性与userType属性结合使用,则可以使用以下$filter有效地仅检索非来宾用户:

If you combine this with the userType property, you can effectively retrieve only non-guest users using the following $filter:

$filter=onPremisesSyncEnabled eq true OR userType eq 'Member'

如果您 /active-directory-aadconnect"rel =" nofollow noreferrer> Azure AD Connect .

You can also avoid this entirely if you Enable synchronization of UserType in Azure AD Connect.

这篇关于如何通过userType = null筛选用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆