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

SharePoint HTTP connector - JSON syntax for 'To' and 'CC' fields

I'm using the POST method to send emails via SharePoint (_api/SP.Utilities.Utility.SendEmail). I've been trying to get  'To' and 'CC' working for multiple emails addresses with commas and semicolons but to no avail. Right now emails only get triggered to the sender without any email addresses in CC.

 

Below is the body output from my most recent run:

 

{
  'properties':{
    'From': '',
    'To': ['test1@gmail.com'],
    'CC': ['test2@gmail.com,test3@gmail.com'],
    'Subject':'Test email subject',
    'Body':'Dear human, hello!'
  }
}

 

 

I also tried the following but this made the connector fail instead:

 

'To': { 'results': [to] },
'CC': { 'results': [cc1] },

 

 

Any advice would be really appreciated, thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @nouptime,

 

Can you try and use this json for the body?

 

In the example below you can replace the variables by e-mail addresses. Examples of values can be:

"jane@contoso.onmicrosoft.com","john@contoso.onmicrosoft.com"
"jane@contoso.onmicrosoft.com"

 

{
"properties":
{"__metadata": {"type":"SP.Utilities.EmailProperties"},
"From":"",
"To": {"results":[@{variables('To')}]},
"CC": {"results":[@{variables('CC')}]},
"Body":"Test Body",
"Subject":"Hello World"
}
}

 

example_sendemail.png

View solution in original post

2 REPLIES 2
Expiscornovus
Super User
Super User

Hi @nouptime,

 

Can you try and use this json for the body?

 

In the example below you can replace the variables by e-mail addresses. Examples of values can be:

"jane@contoso.onmicrosoft.com","john@contoso.onmicrosoft.com"
"jane@contoso.onmicrosoft.com"

 

{
"properties":
{"__metadata": {"type":"SP.Utilities.EmailProperties"},
"From":"",
"To": {"results":[@{variables('To')}]},
"CC": {"results":[@{variables('CC')}]},
"Body":"Test Body",
"Subject":"Hello World"
}
}

 

example_sendemail.png

View solution in original post

Hi @Expiscornovus,

 

Sorry I missed out on your reply. For some reason my post was marked as spam earlier 😅

Excellent, I have tried your suggestion and it works like a charm!

 

Interestingly enough, I found the following seems to work as well:

 

{
  'properties':{
    'From': '',
    'To': ["@{outputs('Get_item')?['body/UserEmail']}"],
    'CC': ["@{outputs('Get_item')?['body/Approver1Email']}","@{outputs('Get_item')?['body/Approver2Email']}",],
  }
}

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,777)