web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Call Graph API with fi...
Power Automate
Unanswered

Call Graph API with filter in query string

(0) ShareShare
ReportReport
Posted on by 88

I'm trying to use the HTTP action to make a call to the Microsoft Graph API to query all active AD users using a certain filter. I've setup the application and bearer token already. It works if I make a call to just the users endpoint (https://graph.microsoft.com/v1.0/users) like this:

 

kubalaml_0-1606339431980.png

But when adding in a filter like this:

 

https://graph.microsoft.com/v1.0/users?$filter=endsWith(mail,'company.com') and JobTitle ne null&$select=userPrincipalName

 

It says "Enter a valid URI"

 

kubalaml_1-1606339862588.png

 

I've added this URI to a variable to get around the error, but when it runs it says "Unsupported Query"

 

"error": {
    "code""Request_UnsupportedQuery",
    "message""Unsupported Query.",
 
I see that there is a Queries section on the HTTP action, but I haven't figured out what format to put my query in to get it to work. 
 
Also I already tested this query in the graph explorer and it works so the problem is not there.
 
Thanks for your help.

 

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @kubalaml 

     

    You need to add a new string variable and enter the below as value

     

    ?$filter=endsWith(mail,'company.com') and JobTitle ne null &$select=userPrincipalName

     

    Map this under the end of url

     

    Please see this article explains about the issue

     

    Combining Microsoft Graph and Flow for Better Office 365 Adminstration - Office 365 for IT Pros (office365itpros.com)

  • Verified answer
    kubalaml Profile Picture
    88 on at

    So part of the issue is that you need to use a variable for the URL. You can do the whole URL or just the query string as suggested above. The other bigger issue is that there seems to be a bug with Power Automate and how it handles filters. If I use 'endswith' or do a comparison against null (ex: 'mail eq null'), then it throws an error, but these works just fine using the Graph Explorer. My work around was to just run the query using the filters that do work, then use the Filter Array action to filter the contents further. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard