Updating EntityImage of CRM record

Hi,
 
Here is the code for updating the image(entityimage) of CRM record.
 
public static void UpdateEntityImageOfContact(IOrganizationService iService, Guid guidContact)
{
      byte[] byteArray = File.ReadAllBytes(@”CRM_Image.png”);
      Entity entContact = new Entity(“contact”);
      entContact.Id = guidContact;
      entContact.Attributes[“entityimage”] = byteArray;
      iService.Update(entContact);
}

Contact Record Before Update
 

 
Contact Record After Update


 
Hope this helps


Happy CRM’img
Gopinath.

2 thoughts on “Updating EntityImage of CRM record

  1. Microsoft CRM June 10, 2016 / 5:33 am

    is there any change to get the Image_url directly from one crm instance and update the same picture in some other crm instance ?I have tried to update the same but when i retrieve the image_url and updating the same picture in some other crm instance but simply it is notupdating the picure..Could you please help me regarding the same.

    Like

  2. Gopinath June 10, 2016 / 5:52 am

    Hi,You need to convert the image to ByteArray and then use the same byte for updating.You cannot use the URL for updating.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s