cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TomasG
Advocate II
Advocate II

How to retrieve email from ODATA format, required for sending e-mail

Hi, I have problem with sending email to specific address. 

Brief description: I retrieve items which have email address. I grouped it together and send email with all items to one email address.

 

I was inspired by this procedure: https://powerusers.microsoft.com/t5/Building-Flows/flow-to-send-single-email-for-set-of-records-in-S...

 

Everything works except sending an email. It takes email address in ODATA format (maybe this is the problem). In action "sending email" the output of this action looks like:

"To": {"@odata.type":"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference","Id":1,"Value":"example@example.cz"}; 


and alert is: BadRequest., and some of the reciever are not valid. 

But when I write only example@example.cz, into the box TO, it works without trouble. 
So it is necessary to trim this output? or problem is somewhere else? 

 

Now I have this solution's output:

Bez názvu.png

 

and this is solution: 

Výstřižek.JPG

Current item bears data as I mentioned above: "@odata.type":"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference","Id":1,"Value":"example@example.cz"

 

Have anybody experience with this? Thanks for answers.

1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

Hi @TomasG ,

 

I guess this is because you did not configure Choice value in the Value field when configuring Append to array variable action.

Generally for Choice column, if you need to reference the field value, you need to reference Choice column value.

 

For example, the type of Email column is Choice:

32.PNG

If you filter the items through Filter array and use Expression to get the field values, you need to configure the following expression:

item()['Email']['Value']

33.PNG

 

 

Or you could keep your current configuration and solve your problem with Parse JSON action:

  • Fill the following content in the location shown to generate the schema.
{"@odata.type":"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference","Id":1,"Value":"example@example.cz"}

34.PNG

  • Then configure Dynamic content originally configured in To field in Content.
  • Finally, the resolved Value is configured in To field, which is the required email address.

35.PNG

 

Please take a try.

 

Best Regards,

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

2 REPLIES 2
Brad_Groux
Community Champion
Community Champion

If you'll review the Send an email (V2) documentation, it states: 

To email
Specify email addresses separated by semicolons like someone@contoso.com
Key: To

I believe the issue you're having is the format of the data you are trying to pass into the to box. Have you tried initializing a string variable with the email address data and passing the variable into the To box?

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!

v-bacao-msft
Community Support
Community Support

Hi @TomasG ,

 

I guess this is because you did not configure Choice value in the Value field when configuring Append to array variable action.

Generally for Choice column, if you need to reference the field value, you need to reference Choice column value.

 

For example, the type of Email column is Choice:

32.PNG

If you filter the items through Filter array and use Expression to get the field values, you need to configure the following expression:

item()['Email']['Value']

33.PNG

 

 

Or you could keep your current configuration and solve your problem with Parse JSON action:

  • Fill the following content in the location shown to generate the schema.
{"@odata.type":"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference","Id":1,"Value":"example@example.cz"}

34.PNG

  • Then configure Dynamic content originally configured in To field in Content.
  • Finally, the resolved Value is configured in To field, which is the required email address.

35.PNG

 

Please take a try.

 

Best Regards,

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

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,539)