cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SylvieLet17
Level 8

Get File Properties from File Name

Hi all, I am trying to achieve something in Flow that was so simple in SharePoint Designer.

I have created a workflow on Library1, and I need it to check Library2 for any file with the Name of the document in Library1, and get that file's properties. Specifically I want the file URL.

In SP Designer I would just create a workflow variable from Library2 using field "Name" and I could choose whatever file property I wanted. enter image description here

But with Flow the Get File Properties seems to throw tons of errors and basically crashes the workflow. It also doesn't allow me to select just one property, but instead proceeds to 'get' all the properties. enter image description here

My desired result is:

When a file is created in Library1, check if a file with the same name exists in Library2. If it exists, get file in Library2's URL and send it in an email.

Can anyone show me an easier way to achieve what I am trying to do? 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Get File Properties from File Name

Hi @SylvieLet17,

 

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

  • Add a "When a file is created (properties only)" trigger, Library Name set to MyLibrary1.
  • Add a "Get file metadata" action, File identifier field set to Identifier dynamic content of the trigger.
  • Add a "Get files (properties only)" action, specify Site Address, Library Name set to MyLibrary2.
  • Add a "Apply to each", input parameter set to output of "Get files (properties only)" action.
  • Within "Apply to each", add a "Get file metadata 2" action, File identifier field set to Identifier dynamic content of "Get files (properties only)" action.

         Add a Condition, click "Edit in advanced mode", type the following formula:

@equals(body('Get_file_metadata_2')?['DisplayName'], body('Get_file_metadata')?['DisplayName'])

Within "If/yes" branch of Condition, add a "Send an email" action, Body field set to Link to item dynamic content of "Get files (properties only)" action.

 

Image reference:24.JPG

 

25.JPG

 

 

The flow works successfully as below:26.JPG

 

 

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

4 REPLIES 4
Community Support Team
Community Support Team

Re: Get File Properties from File Name

Hi @SylvieLet17,

 

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

  • Add a "When a file is created (properties only)" trigger, Library Name set to MyLibrary1.
  • Add a "Get file metadata" action, File identifier field set to Identifier dynamic content of the trigger.
  • Add a "Get files (properties only)" action, specify Site Address, Library Name set to MyLibrary2.
  • Add a "Apply to each", input parameter set to output of "Get files (properties only)" action.
  • Within "Apply to each", add a "Get file metadata 2" action, File identifier field set to Identifier dynamic content of "Get files (properties only)" action.

         Add a Condition, click "Edit in advanced mode", type the following formula:

@equals(body('Get_file_metadata_2')?['DisplayName'], body('Get_file_metadata')?['DisplayName'])

Within "If/yes" branch of Condition, add a "Send an email" action, Body field set to Link to item dynamic content of "Get files (properties only)" action.

 

Image reference:24.JPG

 

25.JPG

 

 

The flow works successfully as below:26.JPG

 

 

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

SylvieLet17
Level 8

Re: Get File Properties from File Name

Fantastic, thank you so much for this extremely clear step-by-step guide Kris. 

I've created it and indeed it is sending me the links to documents. 

I'm going to see if I can adapt this to:

1. Run on a button

2. send an approval email

3. on approval, add the link into a column in Library1

3. add a date in another column in Library1. 

 

Thanks again, this was SO helpful!

 

Sylvie

SylvieLet17
Level 8

Re: Get File Properties from File Name

Hey Kris, 

 

I've noticed in some cases the Apply to Each function is taking a LONG time to complete. For example...it's still running from 3 days ago. Is that simply because it's a heavy command? Will this type of performance get worse as the number of files increases?

 

Thanks,

Sylvie

Cheason
Level: Powered On

Re: Get File Properties from File Name

Sylvie,

 Without knowing for sure, I would guess that it is taking a long time because of the large number of files the 'Get files (properties only) query in the Flow. Expanding the advanced options in there it suggests filter query options, limit the number of columns returned by a view and the top number of rows to return from the query. Those are quite probably for the very reason you're suggesting I'd imagine.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 388 members 6,917 guests
Please welcome our newest community members: