cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Send One File out of Many in a Library Folder at a specified time -

I need to build a flow that every Thursday at 6:30pm, it sends any file that contains the string "Product Availability Report" in the name, from a Sharepoint Library Folder, to a list of users in an outlook email. Historically the file had the same name so this was a simple task. However, the users have now started adding a date to the file name and I need to look for files that contain or start with "Product Availability Report". 1) Start with Recurrence Step at 6:30 weekly 2) Get File Properties Only - with SP Site and Library - where ContentType ne 'Folder' and Top Count = 5000 (a lot of files/folders) 3) Filter Array from Get File Properties Only Value - Where Folder Path equals my source location 4) This returns a body with details of two files in that folder. Since I only want to send the one file I start a Apply to Each Look starting with the body of the Filter Array. 5) Now I plan on using a Condition to determine which file to send but the "Body" and "Current Item" are the only dynamic items I have here. I need to evaluate the file name. How do I proceed? If I can get the condition to work then I assume I would Get File Content and Send Outlook Email.
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Send One File out of Many in a Library Folder at a specified time -

I still can't post pictures yet so I will have to explain this one in text. I solved the issue as follows... 1) Recurrence Step at 6:30 pm each Thursday (Weekly) 2) Get File Properties where Filter is ContentType ne 'Folder' and Top Count = 5000 3) Filter Array on Get File Properties Only "Value" and "Path" = the path of the sub folder I am interested in 4) Apply to Each Construct that uses the Body of the Filter Array 5) Add Condition where items('Apply_to_each')['{Name}'] Starts with the conserved portion of my file name without the date stamp on the end. 6) The "No" condition remains empty 7) The "Yes" condition starts a Get File Content box using items('Apply_to_each')['{Identifier}'] 😎 Then I use a Send Outlook E-mail where the File Attachment Name = items('Apply_to_each')['{FilenameWithExtension}'] and the attachments itself = the File Content from the previous step. To better explain the business process...the File I am interested in is generated by a user and placed in the sharepoint location each week. it has the name "Product Availability Report MM_DD_YYYY". The old file is placed in an archive folder at the same time. The file is then reviewed and edited by 20 or so people. At 6:30pm on Thursday night all editing is to stop and the system will send the final copy to the distribution group. Each editor makes changes to their section and does not know if they are the last editor. So we use the cutoff time for sending the file. Since the file name is dynamic but has a conserved starting name, I can use this flow to grab the correct file each week. This only works becuase it is the only file with that "Starts With" sequence in that folder at any one time. I hope his helps someone else.

View solution in original post

1 REPLY 1
Highlighted
Frequent Visitor

Re: Send One File out of Many in a Library Folder at a specified time -

I still can't post pictures yet so I will have to explain this one in text. I solved the issue as follows... 1) Recurrence Step at 6:30 pm each Thursday (Weekly) 2) Get File Properties where Filter is ContentType ne 'Folder' and Top Count = 5000 3) Filter Array on Get File Properties Only "Value" and "Path" = the path of the sub folder I am interested in 4) Apply to Each Construct that uses the Body of the Filter Array 5) Add Condition where items('Apply_to_each')['{Name}'] Starts with the conserved portion of my file name without the date stamp on the end. 6) The "No" condition remains empty 7) The "Yes" condition starts a Get File Content box using items('Apply_to_each')['{Identifier}'] 😎 Then I use a Send Outlook E-mail where the File Attachment Name = items('Apply_to_each')['{FilenameWithExtension}'] and the attachments itself = the File Content from the previous step. To better explain the business process...the File I am interested in is generated by a user and placed in the sharepoint location each week. it has the name "Product Availability Report MM_DD_YYYY". The old file is placed in an archive folder at the same time. The file is then reviewed and edited by 20 or so people. At 6:30pm on Thursday night all editing is to stop and the system will send the final copy to the distribution group. Each editor makes changes to their section and does not know if they are the last editor. So we use the cutoff time for sending the file. Since the file name is dynamic but has a conserved starting name, I can use this flow to grab the correct file each week. This only works becuase it is the only file with that "Starts With" sequence in that folder at any one time. I hope his helps someone else.

View solution in original post

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (7,686)