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 Apps / Check if a file exists...
Power Apps
Answered

Check if a file exists in user's OneDrive

(0) ShareShare
ReportReport
Posted on by 546 Super User 2024 Season 1

I have a function in the Power App I'm building that takes the contents of an HTML Text box and launches a Power Automate flow that creates an HTML file out of it, saves that to the user's OneDrive in a specific folder, and then converts that HTML to a PDF, saving it in that same folder.  

 

1) Right now, when you click the button that launches this, it just does it, and gives no indication as to whether or not it was successful.  Is there a way that I can test to see if that file was actually created and if it was, notify the user?

 

2) Also, the file name is based on one of the text fields in my application.  Is there a way to make sure that the field in question doesn't contain any characters that would be "illegal" in a file name?

 

3) The HTML file has an image at the top of it which renders correctly.  When the file gets converted to PDF, everything looks fine except for the image - it's missing and the PDF just shows the alternate name for the image instead.  HTML really isn't my forte - is there any special formatting or something that would be needed to properly convert the file to include the image?

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,306 Most Valuable Professional on at

    Hi @zuurg 

    Three questions there . . .

    1. If you are using Launch() to the OneDrive URL, there is no error in Power Apps (it will only appear on the browser), so using IfError() will not help here (so you cannot test this). If you are opening it another way, please advise.
    2. If you are wanting to prevent special characters being used in the file name if this is generated from Power Apps, this blog of mine may assist.
    3. That is a whole different process and depends where you get the image from - this video may assist.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • zuurg Profile Picture
    546 Super User 2024 Season 1 on at

    You're my hero - I've been trying to get that pdf conversion image to work properly for about a month now and that video finally solved the issue - the missing piece was that JSON portion.  Looks like your blog post is exactly what I'm looking for too!

    For the 1st question, all I really need is to be able to see if the file exists.  The way the file gets created is through the call to the Power Automate flow (the file gets created within the flow).  The flow is being launched with: 

    ProjectConcept.Run(Concatenate(varEditConcept.Title,".html"),HtmlTextConceptSummary.HtmlText)
  • WarrenBelz Profile Picture
    156,306 Most Valuable Professional on at

    @zuurg ,

    Without seeing what the Flow is doing, it is a bit hard, but you might consider returning a value to Power Apps at the end of the flow to confirm it worked.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • zuurg Profile Picture
    546 Super User 2024 Season 1 on at

    The flow is pretty simple:

    zuurg_0-1661204372877.png

    How would I have Power Automate return a value to Power Apps if it's successful?

  • Verified answer
    WarrenBelz Profile Picture
    156,306 Most Valuable Professional on at

    Hi @zuurg ,

    Use Respond to a Power App or Flow and send back the Boolean true. You then set a Variable to this (note FileExists is just the name of the Variable sent back - example here

    UpdateContext(
     {
     varExists:
     ProjectConcept.Run(
     Concatenate(varEditConcept.Title,".html"),
     HtmlTextConceptSummary.HtmlText
     ).FileExists
     }
    )

    You then test if the Variable is true (the last bit of the Flow should not run if the creation fails).

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • zuurg Profile Picture
    546 Super User 2024 Season 1 on at

    Thank you so much for your help!  Do you know if they ever got the Yes/No response to work properly?   I set mine to return a Text value of "True" and that's working, but a real boolean would be nicer.

  • WarrenBelz Profile Picture
    156,306 Most Valuable Professional on at

    Hi @zuurg ,

    I have not used the function for a while and all I have only ever returned is Text or a number (which works). I was aware of the Boolean bug, but do not know if it was fixed.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 377 Most Valuable Professional

#2
11manish Profile Picture

11manish 165 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 110 Super User 2026 Season 2

Last 30 days Overall leaderboard