cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Naireb
Advocate II
Advocate II

Use Onedrive connection to look in folder Help

Hi, 

 

So what I would like to do is be able to use powerapps to look in a onedrive folder, such as a folder that I hold a ton of pdfs in. I would like to get '{filenamewithextension}' from all the items in that folder.

This way my end users can use a gallery that shows all of these items and then select one and then view that pdf using the pdf viewer in powerapps or launching that item through the url to that pdf.

 

This is possible to do through sharepoint but I am curious if this was possible to do with onedrive as it is more than likely we are going to use that instead to hold all our pdfs.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Naireb,

Do you want to list all PDF files name in a OneDrive folder within PowerApps?

If you want to list all PDF files name in a OneDrive folder within PowerApps, I think there is no direct way to achieve your needs in PowerApps currently.

I agree with @WPB's thought almost. You could consider take a try to list all PDF file names within a flow, then concatenate these file names into a single one string value with a specific separator (e.g. #), then within your app, you could split the string value into a table value using Split function.

I have made a test on my side, please take a try with the following workaround:

The OneDrive folder structure as below:5.JPG

The Flow's configuration as below:6.JPG

 

7.JPG

Within the "Compose" action (in "Apply to each" action), set the Inputs field to following formula:

concat(variables('FileNamesString'),'#',item()?['DisplayName'])

Within the "Compose 2" action, set the Inputs field to following:

substring(variables('FileNamesString'),1,sub(length(variables('FileNamesString')),1))

Note: The FileNamesString represents the variable initialized using "Initialize variable" action.

The flow works successfully as below:8.JPG

More details about using WDL expression in flow actions, please check the following blog:

https://flow.microsoft.com/en-us/blog/use-expressions-in-actions/

 

App's configuration:9.JPG

 

10.JPG

Set the OnSelect property of the "Call Flow" button to following formula:

Set(FileNames,'20181101_case7'.Run().filenamesstring);
ClearCollect(FileNamesTable,Split(FileNames,"#"))

Set the Items property of the Gallery control to following formula:

FileNamesTable

More details about returning data from Microsoft Flow to PowerApps, please check the following blog:

https://flow.microsoft.com/en-us/blog/return-data-to-powerapps/

More details about starting a flow from an app, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
WPB
Kudo Kingpin
Kudo Kingpin

With OneDrive, you need to use Microsoft Flow for each individual files. I did something like this by populating a list with all the files and then, use the list in PowerApps. When the user wants to see the file, I use a flow to get the Thumbnail image (Faster) and show it in PowerApps.

 

Not a good solution but, it's really limited with OneDrive... 

 

 

Otherwise, you could make a "For each" in Flow to build a list of the files in a specific folder with their shared link and then return it to PowerApps (In a collection). That way, the gallery would show the images and other properties that you wish. Slow but always up-to-date.

@WPB, how do I retrieve this list of file in folder after the flow runs? All I would need from the pdfs is the name and I can generate the URL from there. 

WPB
Kudo Kingpin
Kudo Kingpin

2 Options:

The first and simplest way is to construct a string separated with; or some other specific character in Flow before returning it to PowerApps. In PowerApps, you create a collection by splitting this string by using the specific character.

 

The second, more complex solution is to return the array using the "Response" in Flow. I'm having problems with this right now but, it's worth a try since it's the most powerful solution. 

 

v-xida-msft
Community Support
Community Support

Hi @Naireb,

Do you want to list all PDF files name in a OneDrive folder within PowerApps?

If you want to list all PDF files name in a OneDrive folder within PowerApps, I think there is no direct way to achieve your needs in PowerApps currently.

I agree with @WPB's thought almost. You could consider take a try to list all PDF file names within a flow, then concatenate these file names into a single one string value with a specific separator (e.g. #), then within your app, you could split the string value into a table value using Split function.

I have made a test on my side, please take a try with the following workaround:

The OneDrive folder structure as below:5.JPG

The Flow's configuration as below:6.JPG

 

7.JPG

Within the "Compose" action (in "Apply to each" action), set the Inputs field to following formula:

concat(variables('FileNamesString'),'#',item()?['DisplayName'])

Within the "Compose 2" action, set the Inputs field to following:

substring(variables('FileNamesString'),1,sub(length(variables('FileNamesString')),1))

Note: The FileNamesString represents the variable initialized using "Initialize variable" action.

The flow works successfully as below:8.JPG

More details about using WDL expression in flow actions, please check the following blog:

https://flow.microsoft.com/en-us/blog/use-expressions-in-actions/

 

App's configuration:9.JPG

 

10.JPG

Set the OnSelect property of the "Call Flow" button to following formula:

Set(FileNames,'20181101_case7'.Run().filenamesstring);
ClearCollect(FileNamesTable,Split(FileNames,"#"))

Set the Items property of the Gallery control to following formula:

FileNamesTable

More details about returning data from Microsoft Flow to PowerApps, please check the following blog:

https://flow.microsoft.com/en-us/blog/return-data-to-powerapps/

More details about starting a flow from an app, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Naireb
Advocate II
Advocate II

@v-xida-msft, any reason why it only pulls 20 items?

 

I have many more items, around 200+, and it is only pulling the first 20.

Capture.PNG

Spols
Frequent Visitor

Hello, 

With the flow action "Find files in folder by path" you can go until 100 files but I don't know how to get more.

@WPB - Can you show how you retrieved the thumbnail?  I am having difficulty with getting this to work.

 

Thanks in advance for any information or help you can provide.

WPB
Kudo Kingpin
Kudo Kingpin

I changed to Blob storage. Much faster for what we had to do. We are throwing away Power Apps tho. Too expensive with their new licensing. Hope you find a solution 🙂

@WPB  - Thanks for the update.  I know what you mean on the pricing... that is why I am reduced to using OneDrive and staying away from Premium connectors.  Way too expensive for Premium Connectors, they are going to ruin their base support which had been building and making PowerApps a viable solution.  It's a shame, too.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,753)