Hi,
What i would like is that if a new item is created in a sharepoint list an email must be sent to certain people.
I have put the email addresses in a variable of the type Array. And i have put the variable into the Apply to Each.
But i do not know what to do next so i can declare it in the body of the email.
I do not want to use other Send Email connectors and i am not authorized to get the sharepoint members. i
just want to get the strings out of the array.
Gr. P
Solved! Go to Solution.
Hi @PeKi72,
Sorry, I missed the part about the Array variable requirement 😅
Below is an example which includes that array variable as well.
{
"properties":
{"__metadata": {"type":"SP.Utilities.EmailProperties"},
"From":"",
"To": {"results": @{variables('ToAddresses')}},
"CC": {"results": @{variables('CCAddresses')}},
"Body":"Test Body",
"Subject":"Hello World"
}
}
Hi @PeKi72,
Can you try a body like below:
{
"properties":
{"__metadata": {"type":"SP.Utilities.EmailProperties"},
"From":"",
"To": {"results":["jane@contoso.onmicrosoft.com","john@contoso.onmicrosoft.com"]},
"CC": {"results":["tim@contoso.onmicrosoft.com"]},
"Body":"Test Body",
"Subject":"Hello World"
}
}
And can you also use these Headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose"
}
Hi @PeKi72,
Sorry, I missed the part about the Array variable requirement 😅
Below is an example which includes that array variable as well.
{
"properties":
{"__metadata": {"type":"SP.Utilities.EmailProperties"},
"From":"",
"To": {"results": @{variables('ToAddresses')}},
"CC": {"results": @{variables('CCAddresses')}},
"Body":"Test Body",
"Subject":"Hello World"
}
}
Does not work
Hi @PeKi72,
Can you change the headers and make sure that both Accept & Content-Type use odata=verbose?
Can you also include the metadata in the body and try again?
I can not choose the variable ToAddresses to put it in the body
The variable 'ToAddresses' of type 'Array' cannot be initialized or updated with value of type 'String'. The variable 'ToAddresses' only supports values of types 'Array'.
Hi @PeKi72,
If you cannot select the variable from the dynamic content/value list you could alternatively try to use an expression with a variables function instead?
Below is a short gif to demonstrate how you could achieve this.
User | Count |
---|---|
88 | |
39 | |
23 | |
20 | |
16 |
User | Count |
---|---|
127 | |
49 | |
46 | |
33 | |
25 |