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

Scheduled Occurrence Flow- if a date condition is met, attach files from sharepoint list into email

I'm trying to build a flow that will:

1. Every day, look at the expiration date column in a sharepoint list.

2. If the expiration date is equal to today, then send an email (to a contact specified in the SP list) including the attachment that's also in the list.

 

From reading other posts, I think I need to create an attachments array, but Flow won't let me Get Items and Get Attachments/Initialize Variable.

 

This is my flow so far. It works, but I just can't get the attachment to be included in the email:


flow 1.PNGflow 2.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Scheduled Occurrence Flow- if a date condition is met, attach files from sharepoint list into email

Hi @chanafee ,

 

Do you want to send an email with attachments from a list to specified person when the expiration date is equal to today?

 

After the trigger, initialize an array variable first.

 

Instead of using a Condition to filter expiration date equals to today, I suggest use Filter query of action Get items. The function used in my scenario is:

DueDate eq '@{utcNow('yyyy-MM-dd')}'

 

Then Get attachments and Get attachment content actions. Apply to each and Apply to each2 will be automatically added for each step.

 

Within Apply to each2, under Get attachment content, add Append to array variable with the following value:

 

{

  "Name": ⁠DisplayName,

  "ContentBytes": ⁠ body('Get_attachment_content')['$content']



}

 

 

Under Apply to each2, send an email to specified person. And select Attach variable for the Attachments field.

Note: you need to click the icon to switch to input entire array.

 

Then all the attachments will be sent out to the specified person at a time.

1.PNG2.PNG3.PNG

 

More details about Odata filter query for your reference:

https://flow.microsoft.com/en-us/blog/advanced-flow-of-the-week-filtering-with-odata/

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
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

3 REPLIES 3
Dual Super User
Dual Super User

Re: Scheduled Occurrence Flow- if a date condition is met, attach files from sharepoint list into email

Hi @chanafee 

 

So in your Apply to each loop, before the condition part, add an action -> Get attachments and use the ID from the dynamic selector. After this, add another apply to each action and this time put value from get attachments. Now in this apply to each 2 loop, add an action of condition and on the left side put formatdatetime(spccolumn, dd-mm-yyyy) operator is equal to and then on the right side put formatdatetime(utcnow(),'dd-mm-yyyy'). after this in the yes branch add an action send an email. 

 

This will check for all the attachments in all the items. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Community Support Team
Community Support Team

Re: Scheduled Occurrence Flow- if a date condition is met, attach files from sharepoint list into email

Hi @chanafee ,

 

Do you want to send an email with attachments from a list to specified person when the expiration date is equal to today?

 

After the trigger, initialize an array variable first.

 

Instead of using a Condition to filter expiration date equals to today, I suggest use Filter query of action Get items. The function used in my scenario is:

DueDate eq '@{utcNow('yyyy-MM-dd')}'

 

Then Get attachments and Get attachment content actions. Apply to each and Apply to each2 will be automatically added for each step.

 

Within Apply to each2, under Get attachment content, add Append to array variable with the following value:

 

{

  "Name": ⁠DisplayName,

  "ContentBytes": ⁠ body('Get_attachment_content')['$content']



}

 

 

Under Apply to each2, send an email to specified person. And select Attach variable for the Attachments field.

Note: you need to click the icon to switch to input entire array.

 

Then all the attachments will be sent out to the specified person at a time.

1.PNG2.PNG3.PNG

 

More details about Odata filter query for your reference:

https://flow.microsoft.com/en-us/blog/advanced-flow-of-the-week-filtering-with-odata/

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
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

chanafee
Level: Powered On

Re: Scheduled Occurrence Flow- if a date condition is met, attach files from sharepoint list into email

Thank you!!!!!

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 (Last 30 Days)
Users online (4,995)