1

I need to retrieve a contact from xDB, but I don't have that contact's identifier.

Normally I would do it like this:

ContactRepository contactRepo = Sitecore.Configuration.Factory.CreateObject("tracking/contactRepository", true) as ContactRepository;
Contact contact = contactRepo.LoadContactReadOnly(someIdentifier);

However, the identifier used in LoadContactReadOnly (or in TryLoadContact) is unknown.

I do, however, know the value of some of the other facets on the contact.

How can I get a contact (or many contacts) from xDB that has a specific value in a facet other than Identifier? For example, get all contacts with a specific email address in the Emails.Entries.Preferred.SmtpAddress facet.

  • Do you need it in c# so you can do it over and over? Or something like Robo mongo as a one or two off? – Chris Auer Apr 24 '18 at 14:37
  • @ChrisAuer C#. I know the Robo 3t (formerly RoboMongo) syntax, but unfortunately that's not transferrable to C#. – GTHvidsten Apr 24 '18 at 14:41
  • I think I have used this code before. sitecore.stackexchange.com/questions/4272/… – Chris Auer Apr 24 '18 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.