1

I'm building a canvas PowerApp / Component using React and FluentUI (office-fabric-ui).
(if that limits the ways to solve this feel free to ignore the React part)

Using context.device.pickFile() (documentation) I can trigger a file picker dialog. I added this to my component, tested that in a PowerApp and it works as you'd expect.

However, what I am really looking for is a folder browser. Of course I could ask the user to use the filePicker to select a file in a directory and then get the directory name from that, but that's just a workaround... and what if there is no file to pick in the target directory?

Is there a way to trigger a folder browser?

Arun Vinoth
  • 20,360
  • 14
  • 48
  • 135
Terry Seidler
  • 1,973
  • 14
  • 27

1 Answers1

0

From this SO thread, I believe the below snippet should work.

<input directory="" webkitdirectory="" type="file" />

You can play round and experience it using this code sandbox.

Arun Vinoth
  • 20,360
  • 14
  • 48
  • 135
  • I'll give this a go, but the "This will upload all files from `DIRECTORY NAME`. Only do this if you trust the site" bit makes me afraid it'll actually attempt to upload all files. I just want it to give me the folder name, but it's worth a shot! – Terry Seidler Jul 07 '20 at 08:05
  • 1
    @TerrySeidler: I think you’re looking for tree view control kinda browser but not file upload control. – Arun Vinoth Jul 07 '20 at 09:36
  • Yeah, that's it! :} – Terry Seidler Jul 07 '20 at 09:37
  • @TerrySeidler, try this: https://codeburst.io/practical-recursion-implementing-a-file-tree-view-in-react-electron-af62e7b46d26 – Arun Vinoth Jul 07 '20 at 09:45
  • 1
    We have abandoned the idea - really need a native folder browser, but it does not seem to be possible at this time. Thanks for trying though :) – Terry Seidler Jul 09 '20 at 10:16
  • @TerrySeidler yeah, we don’t have OOB control for that, but PCF is the way to go to develop a new component/control using react, typescript – Arun Vinoth Jul 09 '20 at 14:17