Querying mailing lists

To find a specific mailing list, you use the NewslettersManager class. The following code finds a mailing list with the specified Id through the Native API.

public MailingList QueryMailingList(Guid id)
{
    NewslettersManager manager = NewslettersManager.GetManager();
    MailingList mailingList = manager.GetMailingLists().Where(l => l.Id == id).SingleOrDefault();
    return mailingList;
}

First, you initialize the NewslettersManager. Then, you must call GetMailingLists to retrieve all mailing lists and, finally, you filter the lists based on the Id property.

TIP: You can filter by any of the MailingList properties.

NOTE: You can use the GetMailingList method to retrieve a list by ID. If no mailing list with the specified ID exists, the GetMailingListmethod throws an exception.

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK