+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Bulk load subscribers

Bulk load subscribers

2 posts, 0 answered
  1. Andrew Wrigley
    Andrew Wrigley avatar
    63 posts
    Registered:
    01 Sep 2009
    30 Nov 2009
    Link to this post
    I am looking at the Newsletters module.  Seems easy to use, but what about bulk loading subscribers to a group?  Ie, say I have all the email addresses I want to send it to already in a database table, how would I upload them to a specific subscriber group to save me all the typing?

    Andrew
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    30 Nov 2009
    Link to this post
    Hi Andrew Wrigley,

    You can use the Newsletter API to import the users you have.

    Sample code:

    DataManager dm = new DataManager();
    IGroup subscriberGroup = null ;
    IList subscriberGroups = dm.GetGroups("");  
        ....
         ....
     
     int i = 0;
            while (subscriberGroup == null && i < subscriberGroups.Count)
            {
                if (((IGroup)subscriberGroups[i]).GroupName == "SomeGroupName")
                {
                    subscriberGroup = (IGroup)subscriberGroups[i];
                }
                i++;
            }
            if (subscriberGroup != null)
            {
               .....
                 .....
               
                            ISubscriber subscriber = dm.CreateSubscriber(userEmail);
                            subscriber.FirstName = "first";
                            subscriber.LastName = "last";
                            dm.SaveSubscriber(subscriber);
                            IGroupSubscriber grSubs =
                                dm.CreateGroupSubscriberRelation(subscriberGroup.GroupId, subscriber.SubscriberId);
                            dm.SaveGroupSubscribers(grSubs);
            }



    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered