web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Import Pictures to Entity Image filed CRM

(0) ShareShare
ReportReport
Posted on by

Hi,

I want to import a couple of hundred pictures to different records in the Product entity in CRM. I figured there must be a way to do that using my image path and the Product ID in CRM, and then connect it to the field Entity Image on the Product entity. This field is not visible when I am trying to import data. Neither is it visible on the form, how come since I would assume it is by default on the form since I can add the pictures manually. 

Any ideas? 

Thanks!

/Isabell 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Felippe Profile Picture
    796 on at

    You can dev a batch using the CRM SDK to solve this:

    First get the entitycollection of Products and do a list of correspondent path string.

    Iterate the entitycollection passing the pair <Entity record, path>

    /// <summary>

           /// Receive the entity record and the path of file

           /// </summary>

           public void UploadPhoto(Entity _entity, string path)

           {

               try

               {

                   Image photoContato = Image.FromFile(path);          

                   _entity["entityimage"] = ImageToByteArray(photoContato);

                   _service.Update(_entity);

               }

               catch (Exception ex)

               {

                   Console.Writeline(ex.Message + "\n" + path);

               }

           }

    public static byte[] ImageToByteArray(System.Drawing.Image image)

           {

               using (var ms = new MemoryStream())

               {

                   image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);

                   return ms.ToArray();

               }

           }

    If this solves please "Like" and mark as "Verified Answer"

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans