Hi, yes. This should work:
/api/data/v8.2/SendEmailFromTemplate
Method: POST
{
"TemplateId": "439E68A8-74CF-E711-8121-E0071B658E81",
"Regarding": { "contactid": "e01dc812-f2c5-e711-8119-e0071b66e2e1", "@odata.type": "Microsoft.Dynamics.CRM.contact" },
"Target": {
"subject": "AEmail demo from Web API with Template",
"description": "aThis is the description Template text",
"regardingobjectid_contact@odata.bind": "/contacts(e01dc812-f2c5-e711-8119-e0071b66e2e1)",
"email_activity_parties": [
{ "partyid_systemuser@odata.bind": "/systemusers(23bba18a-35c4-e211-411e-e0071b65be92)", "participationtypemask": 1 },
{ "partyid_contact@odata.bind": "/contacts(e01dc812-f2c5-e711-8119-e0071b66e2e1)", "participationtypemask": 2 }
],
"@odata.type": "Microsoft.Dynamics.CRM.email"
}
}
And getting this response (snippet of the whole response):
{
"@odata.context": "mycloudtest.api.crm4.dynamics.com/.../v8.2$metadata#emails/$entity",
"@odata.etag": "W/\"6069300\"",
...............
}
An new email get sent to the contact. However the field "description" and "subject" from my post does not get used in the email. But the subject and description in the template instead. I tried with placeholders and so but with no luck.
Now i'm creating my own template instead and then use SendEmail Action instead.
/api/data/v8.2/emails
Method: POST
{
"subject": "Email demo from Web API",
"description": "This is the description text",
"regardingobjectid_contact@odata.bind": "/contacts(e01dc812-f2c5-e711-8119-e0071b66e2e1)",
"email_activity_parties": [
{ "partyid_systemuser@odata.bind": "/systemusers(23bba18a-35c4-e211-411e-e0071b65be92)", "participationtypemask": 1 },
{ "partyid_contact@odata.bind": "/contacts(e01dc812-f2c5-e711-8119-e0071b66e2e1)", "participationtypemask": 2 }
]
}
And then the ID for the new created email get used in the next Action, SendEmail.
/api/data/v8.2/emails(insert-guid-of-created-email)/Microsoft.Dynamics.CRM.SendEmail
Method: POST
{
"IssueSend": true
}