Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

Microsoft.Azure.ActiveDirectory.GraphClient Filter Sample Code?

$
0
0

I am using the new Microsoft.Azure.ActiveDirectory.GraphClient and have been able to retrieve all users, and a given user from the ObjectId.  Thanks for the great sample code, very helpful.

I would like to be able to retrieve a single user or group based on a filter.  Or maybe a list of users/groups based on a filter.  But my guesses aren't working, and I'm not finding documentation or sample code that is doing this.

I see where the List method takes a FilterGenerator parameter.   I tried a few different guesses at how to use this pattern.  Perhaps someone can help looking at this code or provide a short snippet of how this is supposed to work.  Or maybe I'm barking up the wrong tree. 

FilterGenerator myFilter = new FilterGenerator();
myFilter.FilterExpressions.Add(new SimpleAnyFilter("Mail", Email));
PagedResults rawUsers = _GraphConnnection.List<User>(null, myFilter);

The error I get is "No property 'Mail' exists in type 'Microsoft.WindowsAzure.ActiveDirectory.User' at position 0."

While User.Mail seems to be the correct property, I've tried a few different property names like Email, or switched to Surname or surname, or sn, with similar results.

Thanks for reading, and in advance for any effort or assistance you may put forward to help.

EDIT: So, case strikes again.  "mail" not "Mail", didn't get the SimpleAnyFilter to work, but the EqualsFilter works as follows:

myFilter.FilterExpressions.Add(new EqualsFilter("mail", Email));
PagedResults rawUsers = _GraphConnnection.List<User>(null, myFilter);



Viewing all articles
Browse latest Browse all 16000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>