Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

How to query user by conditon same property has different values, e.g. GivenName = 'a' or GivenName = 'b'

Vote:
 

I know how to query if the condition is GivenName = 'a' or SurName = 'a'.

But how can I query users by condition GivenName = 'a' or GivenName = 'b'?  UserQuery can only set one Criterion on one property, currently I have to query many times then add them together. If I can query only one time, it save lot of time.

Does anybody have idea?

#63810
Nov 29, 2012 22:15
Vote:
 

I think you should be able to use the StringInCriterion, something like:

var uq = new UserQuery();
uq.GivenName = new StringInCriterion();
uq.GivenName.Values.Add("a");
uq.GivenName.Values.Add("b");

I haven't tried this and I might not remember correctly how to use it. But something like it may work.

#63812
Nov 30, 2012 8:49
Vote:
 

Hi Magnus, thanks for you answer

What should be used is "Includes"

uq.GivenName.Includes = new StringInCriterion();
uq.GivenName.Includes.Values.Add("a");
uq.GivenName.Includes.Values.Add("b");

Thanks again.

#63864
Dec 03, 2012 11:28
Vote:
 

Ah, yes of course, I forgot that level. I suppose it would have been obvious if I had actually tried to assign it :)

#63868
Dec 03, 2012 13:05
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.