Skip to main content

Posts

Showing posts with the label List Manager

Working with Sitecore List Manager API (Version 9.0.1)

I've recently received a simple request to create a newsletter component. It was expected to get visitor's email, save it as contact and add it to newsletter list. I've found couple of example while searching but they were developed for old Sitecore versions. I was searching if there is useful API provided by Sitecore. And yes, I've found what I was looking for: The List Manager API var subscriptionService = ServiceLocator.ServiceProvider.GetService<ISubscriptionService>(); subscriptionService.Subscribe(contactListId, contactId); The code above seems clean and simple. But there is a problem: Where is that "ISubscriptionService"? There is no detail about which library we should use. I had a look at some of the libraries using dotPeek and found then. It is inside Sitecore.ListManager.XConnect This API has another useful method called "CreateSubscribedContact" to create contact but it was not suitable for my case. Because I was ...