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

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
Community Support

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 II
Dual Super User II

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
Community Support

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

Thank you!!!!!

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (4,016)