0

I am getting the user email id using below code in a MS Graph Api code:

user.Mail.Contains("John")

and also user DisplayName check using:

user.DisplayName.Contains("John")

I want Mail and DisplayName to be defined based on specific conditions and store it in a variable.

i.e

if(somecondition){
  searchCriteria="Mail";
}

else{
searchCriteria="DisplayName";
}

and then using interpolation:

user.${searchCriteria}.Contains("John")

But ,it doesn't work in this case.

Please Help.

AllTech
  • 493
  • 5
  • 18

0 Answers0