Search code examples
microsoft-graph-apipower-automate

Parsing value to HTTP Request on Power Automate


Given an output like following, [ { "CompanyName": "CONTONSO" }, { "CompanyName": "M365" }, .... ]

I'm trying to loop through all the Companies running the Graph API Query with no luck.

https://graph.microsoft.com/beta/users?$count=true&$filter=companyName eq @{item('Apply_to_each')} and accountEnabled eq true

The error im getting is:

Unable to process template language expressions in action 'HTTP' inputs at line '0' and column '0': 'The template language function 'item' must not have any parameters.'.

URL works fine if Company Name is typed manually, but im not able to get it to work using the loop items. (Query requires header ConsistencyLevel with value Eventual)

Any help will be appreciated.


Solution

  • Edited query and error was gone. This is the final query:

    https://graph.microsoft.com/v1.0/users?$count=true&$filter=accountEnabled eq true and companyName eq '@{item()['CompanyCode']}'
    

    Thanks to Skin comment for pointing out