Import subscribers with custom fields

With Sitefinity CMS, you can import and export subscribers to mailing lists. You may also have subscribers with custom fields, for example, Phone number or Company. By default, Sitefinity CMS does not take any custom fields during import or export of subscribers.

You can import subscribers with custom fields by creating a separate user widget or page for this specific purpose. The following code sample demonstrates how to import subscribers' list in Sitefinity CMS from the MySubscribers CSV file:

In the code above, you get an instance of the NewslettersManager class, which you later use to create new subscribers. To open a CSV file, you use the File class and read the contents of the file line by line. In this example, the first line contains column headers that correspond to the field names of subscribers, for example First name and so on. The rest of the lines in the CSV file contain the field data for each subscriber, including the custom fields. Using the CreateSubscriber method of the the newsletters manager, you create a new subscriber and set the desired field values. Finally, you save the changes of a the newsLetterManager class.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?