cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TheresePawlicki
Level: Powered On

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
TheresePawlicki
Level: Powered On

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}'] 8) 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.
1 REPLY 1
TheresePawlicki
Level: Powered On

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}'] 8) 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.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

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 Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 134 members 4,553 guests
Please welcome our newest community members: