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:
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 🙂
Solved! Go to Solution.
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 🙂