I am trying to remove a contact from a contact list using next code:
using (var client = SitecoreXConnectClientConfiguration.GetClient())
{
var reference = new IdentifiedContactReference(source, email);
var contact = client.Get(reference, new ContactExpandOptions(new string[]
{
"ListSubscriptions"
}));
if (contact == null) return;
Guid contactListId = new Guid(ListId);
IDefinitionManager<IContactListDefinition> manager = ServiceLocator.ServiceProvider.GetDefinitionManagerFactory().GetDefinitionManager<IContactListDefinition>();
var contactList = manager.Get(contactListId, new CultureInfo("en"), true);
contact.RemoveListSubscriptions(client, true, new Guid[]
{
contactListId
});
client.Submit();
}
I can see the list in the ListSubscriptions
facet but is not removed. Am I doing something wrong?