question

17487350 avatar image
0 Votes"
17487350 asked saldana-msft edited

does it possible to filter B2C users by custom attributes with IN and NOT IN clauses or HAS clause?

@amanmcse
https://graph.microsoft.com/beta/users?$filter=extension_[appid]_AppRole in ( 'a')

microsoft-graph-usersazure-ad-app-managementmicrosoft-graph-extensionsmicrosoft-graph-query-parameters
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @17487350 This question is too broad, what information do you want to filter?

0 Votes 0 ·

Hi @CarlZhao-MSFT
Need to filters B2C users based on the user custom property.

https://graph.microsoft.com/beta/users?$filter=extension_[appid]_AppRole in ( 'a')

1 Vote 1 ·

As far as I know, dynamic property doesn't support filter IN operator, have you tried eq? https://graph.microsoft.com/beta/users?$filter=extension_[appid]_test eq 'value'

0 Votes 0 ·
Show more comments

1 Answer

CarlZhao-MSFT avatar image
1 Vote"
CarlZhao-MSFT answered CarlZhao-MSFT commented

Hi @17487350

According my test, dynamic property doesn't support filter IN or NOT operators. I suggest you submit a user voice to add support for this feature.

Or you can also use the startswith operator, which should also work:

 https://graph.microsoft.com/beta/users?$filter=startswith(extension_[appid]_AppRole,'role1') or startswith(extension_[appid]_AppRole,'role2')

If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks @CarlZhao-MSFT
"startswith" working fine.

doe it possible to filter the users who are not having the role1.
I dont want to use the OR clause here.

1 Vote 1 ·

https://graph.microsoft.com/beta/users?$filter=startsWith(extension_[appid]_AppRole, 'role2')
startswith only working with role1 not role2 and role3

0 Votes 0 ·

You mean, it doesn't work for role2 and role3?

0 Votes 0 ·

Hi @17487350

This is just one way I found, if it doesn't meet your requirements, I'd still suggest you submit a user voice to add support for the filter IN operator, and I'll upvote it for you :)

0 Votes 0 ·