Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
Menu

Get link to a folder of a newly created file with Power Automate

Posted on March 1, 2023March 1, 2023 by Tom

“I’d like to send a link to the whole folder with the newly created file, how can I get such link with Power Automate?”


If you trigger flow on a new file in a SharePoint library, you probably send a link to this file in some message, whether it’s a Teams message or an email. The link is hidden under the ‘Link to item’ dynamic content and that’s all you need. Just one dynamic content. But what if it’s not just about the single file? If the users should know about all the other files in the same folder? How do you build a link like that?

Start with the Folder path

There’re two dynamic contents related to the file location – Full Path and Folder path.

Full Path will give you the path to the file on the specific site, including the file name, e.g.

Shared Documents/PDF files/Subfolder/file.pdf

Folder path will give you the same, excluding the file name, e.g.

Shared Documents/PDF files/Subfolder/

…and that’s where you want to start. But it’s only the start as you can see that it’s missing the url of the SharePoint site.

Add the site url

Since all flows are bound to a SharePoint site, you can hardcode that site in the url. Use the concat(…) expression to combine it with the folder path.

concat('https://xxx.sharepoint.com/sites/siteName/', triggerOutputs()?['body/{Path}'])

Replace the spaces

Depending on your usage of the link there might be one more thing to do. If you send it as a plain link, it’ll end the url with the first space.

To turn it into a whole link you must get rid of the spaces. Add one more expression around the concat(…) to replace(…) each space with the %20 character (an url representation of a space).

replace(concat('https://xxx.sharepoint.com/sites/siteName/', triggerOutputs()?['body/{Path}']),' ', '%20')
Power Automate folder link

Once you replace the spaces you’ll get a fully working (and clickable) url.

Power Automate folder link

Summary

While Power Automate doesn’t give you a direct link to a folder with a specific file, you can build it yourself. Take the SharePoint site url that’s fixed, add the folder path, and replace the spaces. That’s it, you just built a direct link to a folder with that specific file.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

  • How to find Excel rows missing in SharePoint list (Power Automate)March 29, 2023
  • Check whether user exists in AAD with Power AutomateMarch 26, 2023
  • How to highlight whole SharePoint row based on calculated dateMarch 22, 2023
  • Why is your Power Automate flow running so slow?March 19, 2023
  • How to add multiple links to the Power Automate approval taskMarch 15, 2023

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes