0

I have developed a custom ASPX page for uploading the contacts from csv file into List manager. This should work almost same as the built-in List manager import feature except for that there are few extra fields where I want the content editors to add more information about the list. I also wanted the copy of all contacts to be stored in SQL server Custom DB.

The csv file is uploaded to Sitecore, A new contact list is getting created, the copy of contacts and all associated facet data are stored in the custom database table, but the contacts are not getting created in the new contact list.

I have tried ClientApi.TrySubscribe() and many other methods like AddRecipient() and AssociateContacts() methods from List Manager API but nothing worked.

I am using Sitecore 8.2.3 and It is scaled environment with 1 CM and 1 CD. My ASPX page is hosted on CM server only.

Please help

1 Answer 1

1

If I remember correctly, there were multiple was of adding contacts to contact list in Sitecore 8.

You can try ClientApi.UpdateSubscription method like that:

var recipientId = new Sitecore.Modules.EmailCampaign.Xdb.XdbContactId(contact.ContactId);

  Sitecore.Modules.EmailCampaign.ClientApi.UpdateSubscriptions
    (recipientId, new[] { contactListId }, new string[] { }, managerRootId, false);

or contact.Tags.Set like:

contact.Tags.Set("ContactLists", listItem.ID.ToString());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.