Modifying a mailing list
To modify a specific mailing list, you use the NewslettersManager class and LINQ queries. The following code modifies a mailing list through the Native API.
public void ModifyMailingList(Guid id, string newTitle, string newSubject)
{
NewslettersManager manager = NewslettersManager.GetManager();
MailingList mailingList = manager.GetMailingLists().Where(l => l.Id == id).SingleOrDefault();
if (mailingList != null)
{
mailingList.Title = newTitle;
mailingList.DefaultSubject = newSubject;
manager.SaveChanges();
}
}
First, you initialize the NewslettersManager. Then, you get the specified mailing list. Then, you check whether an item with the specified IDexists. Finally, you modify the title and the subject, and save the changes.
See Also