web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get email adress from ...
Power Automate
Unanswered

Get email adress from dynamic content / sharepoint list

(0) ShareShare
ReportReport
Posted on by

I'm trying to dynamically get email adresses from a sharepoint to the "To" field in Send email action (positioned below showed apply for each).

 

Flow:

1. List files in OneDrive folder

2. Condition to check if any filenames contains keywords (DRIP and PVT in this case)

3. If yes - Get file content and append to array for attachment to Send Email, then move those files to a "Sent"-folder.

4. Send email with attachment

 

This works as intended.

 

But now I'm trying to dynamically get email adress instead of typing it out in the flow. I created a sharepoint list with several columns, two of them containing different keywords (field_ 3: DRIP, field_2: PVT).

 

field_1 contains the email adress.

 

Basically I want the flow to add email adress from sharepoint list matching the same keywords in the files handled in the loop.

 

If I have the Send Email action outside the loop I cant get the dynamic value from the "Get Items"-filter (which is inside the loop), and if I put the Send Email action INSIDE the loop I can choose the dynamic content from "Get Items" but then the Send Email action gets put into another "Apply for each" and the flow sends multiple emails if attached files are 2 or more.

 

If it's 3 files it sends 3 emails (email 1 with attachment 1, email 2 with att 1+2, email 3 with att 1+2+3).

 

Also dont really know the syntax for get items filter to give me the email adress if the keywords are matched.. 😞

 

test1.png

test2.png

Categories:
I have the same question (0)
  • v-jefferni Profile Picture
    on at

    Hi @Anonymous ,

     

    The send email action should be inside the loop, the point is you will get an array from "Get items" from SharePoint list. So, the solution will be:

    1. Set filter query expression to:

    substringof('DRIP',field_ 3) and substringof('PVT',field_2)

    contains is not supported in Odata filter query:

    https://sharepains.com/2018/11/12/sharepoint-get-items-odata-filter-query/

     

    2. Initialize a string variable, use join function to concatenate all the filtered emails with a ";" and use it for the send email To parameter:

    join(outputs('Get_items')?['body/value']?['field_1'],';')

    https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#join

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Community Power Platform Member Profile Picture
    on at

    But how do I stop the email from sending 20 times to the same adresses when it finds 20 files matching the filter? I had to put it outside the loop the prevent that.

  • v-jefferni Profile Picture
    on at

    Hi @Anonymous ,

     

    I thought there would not be duplicate values from the filtered items. If there are, you could add a variable, use union function the get the distinct values before the join function:

    join(union(outputs('Get_items')?['body/value']?['field_1']),';')

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Community Power Platform Member Profile Picture
    on at

    b1tz_0-1648458464980.png

    Got this error. Looks like it's because that column is "Multiple lines of text"? Can you only use "Single Line of text"? Makes no sense. 

  • Community Power Platform Member Profile Picture
    on at

    Also: 

    b1tz_1-1648459057054.png

    It didn't output the email, only the same expression. So email recipient becomes "join(union(outputs...". Tried setting variable as array but didnt work either because "Set variable" writes in 'string'.

  • Community Power Platform Member Profile Picture
    on at

    In case it helps, here is the whole flow incl. sharepoint list. 😞

     

    flow1.png

    flow2.png

    flow3.png

    flow4.png

  • v-jefferni Profile Picture
    on at

    Hi @Anonymous ,

     

    Answer to the first question, Multi-lines of text columns are not supported for filter query, below is a blog where introduces a workaround:

    https://tomriha.com/power-automate-filter-on-multiple-lines-of-text-sharepoint-column/

     

    For the second question, the result you need to set in To property of Send an Email action is exact a sting:

    a@123.com;b@123.com;c@123.com;

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Community Power Platform Member Profile Picture
    on at

    Yes, I thought your join function would get the email(s) to the variable "DRIP mail", then I choose the variable in send email "To" field but it didn't work.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard