Modifying message bodies
To modify a specific message body, you use the NewslettersManager class. The following code modifies a message body through the Native API.
public void ModifyMessageBody(Guid id, string newName, string newBodyText)
{
NewslettersManager manager = NewslettersManager.GetManager();
MessageBody messageBody = manager.GetMessageBodies().Where(b => b.Id == id).SingleOrDefault();
if (messageBody != null)
{
messageBody.Name = newName;
messageBody.BodyText = newBodyText;
manager.SaveChanges();
}
}
First, you initialize the NewslettersManager. Then, you get the specified message body. Finally, you modify the title and the body text, and save the changes.
See Also