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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Unable to Extract Cont...
Power Automate
Unanswered

Unable to Extract Contents of Site Pages (Error - The execution of template action 'Apply_to_each_2' failed: the result of the evaluation of 'foreach' expression '@items('Apply_to_each')' is of type 'Object'. The result must be a valid array.)

(0) ShareShare
ReportReport
Posted on by 4

I am trying to extract Site pages using "Get files (properties only)". But then, there are around 7 columns having Managed Metadata (lookup columns). So, I wasn't able to pull those 7 columns data. I then used the "Get Items" action and tried to pull the values using "Select" data operation and whenever I selected the lookup column values the "apply to each" started nesting on each value that I applied (as shown in the image).

 

niftyninjaa_2-1673177172353.jpeg

 

niftyninjaa_1-1673177144208.png

 

niftyninjaa_3-1673177196796.jpeg

 

niftyninjaa_4-1673177236097.jpeg

 

niftyninjaa_5-1673177249411.png

 

My question here is, if I initialize the variable for each column and use the "add property" expression, will I be able to bypass the apply to each nesting?

 

I am trying to extract the whole site pages (we have 1000s of solution catalogs as pages) list into Excel. I know we have an "export to excel" button, but I wanted to automate it. Will GET from "send an HTTP request to SharePoint" work?  

 

Regards,

Chan

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,970 Most Valuable Professional on at

    Hi @niftyninjaa,

     

    Are all these managed metadata columns single or multi-value type columns? 

     

    singlevaluecolumns.png

     

    In case of the first you can use the label property of the field.

     

    clientneedslabel.png

     

    Below would be an example how to use that in a Select.

     

    When you add the value field first to the From field in the Select action, Power Automate should not automatically add the apply to each to your flow.

     

    clientneedslabel_withoutapplyto each.png

  • niftyninjaa Profile Picture
    4 on at

    Hey @Expiscornovus ,

     

    Thanks a lot for the insights. Some of the Managed Metadata is multi-value type columns.

     

    The Value / Label field never shows as an option in the dynamic field until I use value as input in "Apply to each". Should I type the column name/Label as an expression?

     

    Regards,

    Chan

  • Expiscornovus Profile Picture
    33,970 Most Valuable Professional on at

    Hi @niftyninjaa,

     

    Yes, typing the expression would be the workaround. This way you prevent the apply to each from being added and you can still refer to the fields you want.

     

    However, for the multi-value managed metadata you might need a different approach. In that case I would suggest the xml/xpath fuctions approach with a text() function.

     

    It is slightly more complicated, but very good when setup correctly 😁

     

    @grantjenkins recently shared such a solution: https://powerusers.microsoft.com/t5/Building-Flows/Expression-to-Get-DisplayName-from-SharePoint-People-Picker/m-p/1913160/highlight/true#M210643

     

    In your setup it could be like below

    I am looking up the Label values of both type of columns (single and multi value MMS fields).

     

    From Field

    xpath(xml(json(concat('{"root": { value:', outputs('Get_files_(properties_only)')?['body/value'], '}}'))), '//root/value')

     

    Map field for Client Needs key value field (single value MMS field)

    xpath(item(), 'string(//Client_x005F_x0020_Needs/Label/text())')

     

    Map field for another multi-value MMS field (In this example called products)

     

    join(xpath(item(), '//Products/Label/text()'), ', ')

     

    xpath_xml_text_mmsfields.png

     

  • niftyninjaa Profile Picture
    4 on at

    Hey @Expiscornovus ,

     

    Apologies for the delay, i did try your suggestion few weeks back and it did not work. Please refer the following screenshots. Will this be because of access issue? we are not admins of the site, only editor access.

     

    Empty outputEmpty outputExpression inputs just using xpathExpression inputs just using xpathEmpty Output.Empty Output.Expression inputs using join(xpath())Expression inputs using join(xpath())Expression in the From fieldExpression in the From field

  • Expiscornovus Profile Picture
    33,970 Most Valuable Professional on at

    Hi @niftyninjaa,

     

    Can you share a screenshot of the outputs section of the Get files (properties only)?

     

    Just want to double check what type of data you have over there and also the internal names of the fields you are using.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard