cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MGeale
Helper I
Helper I

GraphAPI HTTP Request on name instead of ID

Hi All,

 

Hoping someone could point me in the right direction because I can't seem to figure out what I'm doing wrong.

I'm trying to use the graphAPI to get the ID of a group (distribution list) using the display name, but I keep getting a 'invalid filter clause' error which makes me to believe my graphAPI call is incorrect; I haven't successfully found any documentation on using names instead of IDs except for this previous Flow post but I can't seem to get what they're doing to work in my scenario.

These are a few of the GraphAPI calls I've been using but none appear to be correct formula for flow to play nice:

 

 

 

https://graph.microsoft.com/v1.0/groups/?$search="displayName:#QLD-XXX-IT - All IT"
https://graph.microsoft.com/v1.0/groups/?$filter=startswith(displayName,'#QLD-XXX-IT - All IT')
https://graph.microsoft.com/v1.0/groups/?$filter=startswith(displayName,'#QLD-XXX-IT - All IT')
https://graph.microsoft.com/v1.0/groups/?$filter=displayname+eq+'#QLD-XXX-IT - All IT'

 

 

 

 I went into the Office365 admin portal and manually got the groupID and can successfully get the data I need when the ID is statically set. However, I need this flow to be dynamic due to the use case (getting Distribution List email from DL name entered in SharePoint). This is the API Call that does work, when the groupID is static:

 

 

 

https://graph.microsoft.com/v1.0/groups/b8fb9015-f7f7-423e-8477-[REDACTED]

 

 

 

Both the above code blocks are being executed using the Office365 Groups function in Power Automate calling a HTTP Request (Preview).

Any help would be appreciated 🙂

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions
mgrachii
Resolver I
Resolver I

3 REPLIES 3
VictorIvanidze
Community Champion
Community Champion

Hi @MGeale

open the Graph explorer and play a bit to get a valid request. After that try to execute the same request using a flow action.

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.
mgrachii
Resolver I
Resolver I

hi, can you try removing the "/" at the very end? 

should look like this

https://graph.microsoft.com/v1.0/groups?$filter=startswith(displayName,%27#QLD-XXX-IT%20-%20All%20IT')

 

MGeale
Helper I
Helper I

Hi @mgrachii,

Thanks for your assistance - I managed to get it in the end using the the exact same logic - with a few minor tweaks :). I chucked the above into the GraphAPI explorer and all works a treat and returns code 200. I wasn't aware you needed to replace the white space or special characters in these types of instances. I'll mark what you put above as the solution as it solves my needs 🙂

For those who run into the same issue I do:

Use an encodeURIComponent, compose function, to change your DL group's name into a URI friendly format. I'm unsure if its just the GraphAPI or APIs in general but they don't like special characters ie # , _ - etc. I don't know if that 'knowledge' comes from experience, but I couldn't find a single mention of 'URI structure' in the GraphAPI documentation or anywhere when searching for an answer. I know I'm a noob so I'm sure that understanding just comes from experience of which I don't have a lot of. 

Thanks again guys for your help 🙂

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,599)