Search code examples
jsonpower-automatepowerapps

In Powerapps; present folders and files in a gallery


I have tried following several online guides but the results are never quite what I need.

The closest I have come is to use Power Automate (Flow named: PAFolderRtn) enter image description here

with 'Get files (properties only)' Then a 'Select' to just get the columns I want

The (Text) output through 'Respond to a PowerApp or flow' is;

{
  "rtntm": "2023-11-20T13:03:34.5025608Z",
  "rtnoutput": {
    "body": [
      {
        "FileNameExt": "Delivery Partner",
        "isFolder": "True",
        "Path": "CDS/3_Service Area/"
      },
      {
        "FileNameExt": "CDS_ElectricCar_BookingSheet.xlsx",
        "isFolder": "False",
        "Path": "CDS/3_Service Area/"
      }
    ]
  }
}

Back in PowerApps, A button runs;

OnSelect = Set(PAFR,PAFolderRtn.Run("/CDS/3_Service Area/"))

and in the Gallery

Items = Table(ParseJSON(PAFR.rtnoutput))

So far I get 'expected string but got object' Error

Thanks for anyone's help on this!

NB: I tried referring the output to the Get Files body but have the same issue


Solution

  • So I posted this question after several days trying different methods and found the answer in a vaguely related question; answer from 2020

    Their answer was brief so I found a walkthrough of Request vs Response here; https://www.youtube.com/watch?v=oV9AkIQmemI

    The issue was my final step, 'Respond to a PowerApp', is not passing complex data back to Apps, NB: I have a HTTP request that does work by returning a JSON so I don't know what's up there. Instead I used the Premium feature of 'Request' which returns my data as a Table!