The Email Experience Manager can use various sources of recipients to send email campaigns, including both the sources provided by Sitecore and your own sources.
The EXM has two recipient repositories:
XdbRecipientRepositoryis connected to xDB contacts.
MultiRecipientRepositoryaggregates multiple internal repositories and enables the requesting of a recipient without specifying their location. This repository sends the request to internal repositories in a given order, until it retrieves the recipient.
A recipient repository implements the abstract base class
Retrieving a recipient
RecipientRepository class provides the following methods to retrieve recipients:
- To retrieve a full recipient profile with all the properties, use the
GetRecipient([NotNull] RecipientId recipientId)
- To retrieve a specific set or recipient properties, use the
GetRecipientSpecificmethod and specify the properties that you need:
GetRecipientSpecific([NotNull] RecipientId recipientId, [NotNull] IEnumerable<Type> propertyTypes)
Creating certain types of properties requires an additional search in a database, which is time consuming and resource intensive. When you retrieve only the necessary properties, this lets you save time and repository resources.
A recipient repository can recognize a recipient ID of the corresponding type by its string representation and convert it into an instance of the
RecipientId type. You must ensure that each type of recipient IDs has its unique and unambiguous string representation. To distinguish the default types of recipient IDs, EXM uses the following prefix:
xdb:– for xDB contacts.
The following method parses an input string and returns a
RecipientId instance when it is parsed successfully:
ResolveRecipientId([CanBeNull] string input)
The default recipient repository
You can configure the default repository for the EXM module in the
<recipientRepository type="Sitecore.Modules.EmailCampaign.Recipients.MultiRecipientRepository, Sitecore.EmailCampaign" singleInstance="true">
<xdbContacts type="Sitecore.Modules.EmailCampaign.Recipients.XdbRecipientRepository, Sitecore.EmailCampaign" singleInstance="true" />
To retrieve the default repository programmatically, use the following static method: