How can to edit a E-mail template Body by plugin in CRM 2016?
the Template it is already exist ,I retrieve the Template ID by code plugin , and i want edit the message body by plugin.
to retrieve the message body email template i use with 'description' attribute. and if i want to update the body email template with this attribute ,with 'description', this updated the description box not the body message.
The following code describes receiving an e-mail template, how can update the message body by this Template?
//=============get template by name==================
private Entity GetTemplateByName(IOrganizationService client, string templateName) { var query = new QueryExpression();
query.EntityName ="template";
var filter = new FilterExpression();
var condition1 = new ConditionExpression("title", ConditionOperator.Equal, new object[] { templateName });
filter.AddCondition(condition1);
query.Criteria = filter;
EntityCollection allTemplates = client.RetrieveMultiple(query);
Entity emailTemplate = null;
if (allTemplates.Entities.Count > 0) {
emailTemplate = allTemplates.Entities[0];
}
return emailTemplate;
}
Thanks
