Delete message templates

Using the Native API, you can delete one or all message templates at once.

Delete a single message template

To delete a specific message template, you use the NewslettersManager class. First, you initialize the NewslettersManager. Then, you check whether an item with the specified ID exists. Finally, you delete the message template by calling DeleteMessageBody and save the changes.

The following code deletes a message template with specific ID with the Native API:

Delete all message templates

To delete all message templates, you use the NewslettersManager class. First, you initialize the NewslettersManager. Then, you get all the available message templates. Then, you iterate the collection deleting the message templates one by one. Finally, you save the changes.

The following code deletes all available message templates with the Native API:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?