Posts

Showing posts with the label Avatar Facet

Contact Profile Image Using Avatar Facet in Sitecore

Image
Sitecore xConnect provides several default facets like personal information, AddressList, EmailAddressList, etc. Avatar is one of them and it comes under the IContactPicture Legacy facet. If you are new with Sitecore xDB and xConnect and need more insight on the Custom facet, How to create and set/update the facet then you can refer blog post Work with Custom Facet in Sitecore and Create Custom Facet in Sitecore. In this article, I am going to describe how to set the contact picture in the Avatar facet which we can see in the details tab in the experience profile window. private bool SetAvatarFacets(byte[] imageBytes, string mimeType, Contact contact, IXdbContext client) { var pictureData = imageBytes; var pictureMimeType = mimeType; var avatar = contact.GetFacet<Avatar>(Avatar.DefaultFacetKey); //Facet is null if (avatar == null) { avatar = new Avatar(pictureMimeType, pictureData);