Tuesday, 9 June 2015

Updating EntityImage of CRM record

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;

Contact Record Before Update
Contact Record After Update

Hope this helps

Happy CRM'img


  1. 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.

    1. Hi,

      You need to convert the image to ByteArray and then use the same byte for updating.

      You cannot use the URL for updating.