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:
Solved! Go to Solution.
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.
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
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!
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.
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
Thank you!!!!!
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
At the monthly call, connect with other leaders and find out how community makes your experience even better.
User | Count |
---|---|
25 | |
24 | |
23 | |
23 | |
19 |
User | Count |
---|---|
60 | |
40 | |
40 | |
29 | |
25 |