1

I've used this Flow to return the count of any Sharepoint list to Powerapps.

https://masteroffice365.com/get-sharepoint-library-or-list-total-items-from-power-apps/

How would I modify it to return the contents of a list to Powerapps, so that I can use Powerapps to put it into a collection?

Would this mean I don't have to worry about Delegation if the list has more than 2000 items?

This is what I've tried so far.

There is a variable TotalItemsCount which I have changed to ListItems. Instead of using an Integer I set ListItems to an array.

In the Get Library list contents I use this for the URI.

concat( '_api/web/lists/GetbyTitle(''', first( body('Filter_Library_List_Being_Queried') )?['displayName'], ''')/Items' )

I'm not sure what to put in as the last step given that I want it to be able to return the contents of any list. I think this rules out a parse json step as that requires a definite schema.

I've added an ApplyToEach enter image description here

I'm getting this error message when it runs.

ExpressionEvaluationFailed. The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Get_Library_List_Contents')' is of type 'Object'. The result must be a valid array.

Our Man in Bananas
  • 5,809
  • 21
  • 91
  • 148
AlHal
  • 361
  • 3
  • 21

2 Answers2

2

I don't think you can return an array back to PowerApps. You would have to return the response as a JSON string, then have your PowerApp do the logic to convert the JSON string into a collection.

Likely your PowerApp would have to include something like this to convert the JSON string that's returned from the flow:

ClearCollect(
  *collectionName*,
    MatchAll(
      *JSON_String*,
    *"\{""date"":""(?<date>[^""]*)"",""message"":""(?<message>[^""]*)"",""user"":""(?<user>[^""]*)""\}"*
));

Flow returning response body to PowerApp

JBerg
  • 411
  • 1
  • 3
  • how do we get the flow to retuen a JSON array? – Our Man in Bananas Jun 29 '22 at 07:49
  • I saw it's possible to use the Response action on https://powerusers.microsoft.com/t5/Using-Connectors/Returning-JSON-Array-to-Power-Apps/td-p/1263412. Is it possible to achieve the same without a premium connector? – AlHal Jun 29 '22 at 08:10
  • @OurManinBananas check out the image of the flow I attached "Flow returning response body to PowerApp" – JBerg Jun 29 '22 at 13:26
1

If I understand you correctly, you want to retrieve 14000 records from the Sharepoint list, and not just the total count.

Would this mean I don't have to worry about Delegation if the list has more than 2000 items?

Yes, when you use a cloud flow rather than directly accessing Sharepoint list from Powerapps, you basically avoid delegation of 2k records.

Now coming back to you main topic of retrieving Records, you would have to Test and run your flow and check what does the below http return. I believe it returns a JSON Array.

concat( '_api/web/lists/GetbyTitle(''', first( body('Filter_Library_List_Being_Queried') )?['displayName'], ''')/Items' )

You would have to apply a for each or clean your JSON output to return String Array or JSON Array as output of your all 14K Records.

In addition if you are using Sharepoint online why not use connector for flow mentioned here

Our Man in Bananas
  • 5,809
  • 21
  • 91
  • 148
AnkUser
  • 5,421
  • 2
  • 9
  • 25