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

Microsoft.Azure.ActiveDirectory.GraphClient query with $filter???

$
0
0

Hi.

I've got the following query working:

var userLookupTask = client.Users.Where(user => user.UserPrincipalName.Equals(
        "abc@here.com", StringComparison.CurrentCultureIgnoreCase)).ExecuteSingleAsync();
            User userToUpdate = (User)await userLookupTask;
 

But I would like to be able to feed in a string $filter like "userPrincipalName eq abc@here.com". I've seen the example below that uses DataServiceQuery but am clueless how to adapt it for Microsoft.Azure.ActiveDirectory.GraphClient:

// Create the DataServiceContext using the service URI.
NorthwindEntities context = new NorthwindEntities(svcUri);
// Define a query for orders with a Freight value greater than 30
// and that is ordered by the ship date, descending.
DataServiceQuery<Order> selectedOrders = context.Orders
    .AddQueryOption("$filter", "Freight gt 30")
    .AddQueryOption("$orderby", "OrderID desc");

try
{
    // Enumerate over the results of the query.
    foreach (Order order in selectedOrders)
    {
        Console.WriteLine("Order ID: {0} - Ship Date: {1} - Freight: {2}",
            order.OrderID, order.ShippedDate, order.Freight);
    }
}
catch (DataServiceQueryException ex)
{
    throw new ApplicationException(
        "An error occurred during query execution.", ex);
}

Any ideas?


Viewing all articles
Browse latest Browse all 16000

Trending Articles



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