Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Add image for product entity record and export it.

Posted on by 900

Hi,

I am using product enity and I want to add product image. Is it possible ?

Also I need to export product record with its images. Is it possible ?

Thanks,

keyur shah.

*This post is locked for comments

  • Suggested answer
    keyur7379 Profile Picture
    keyur7379 900 on at
    RE: Add image for product entity record and export it.

    In excel CRM only use view for exporting data. So without customization we could not show image in excel file.

    System enitity have one enitityimage field and display it from form property. So it is usable for set image for record.

    I got enitityimage field in word template. It is working for me.

    1. Create word template for entity.

    2. Go to developer section.

    3. Use xml source. now you have enitity all fields.

    4. Find enitityimage field and drag&drop.

    Thanks,

    keyur shah.

  • Suggested answer
    imayur Profile Picture
    imayur 630 on at
    RE: Add image for product entity record and export it.

    Hi,

    Setting a product image is OOB functionality. After setting image for product, while exporting to excel you can retrieve product image using producturl property

    Refer below code to retreive image file from product

                   var url = imageurl;

                   if (!string.IsNullOrEmpty(url))

                   {

                       WebRequest request = WebRequest.Create(url);

                       WebResponse response = request.GetResponse();

                       var imgstream = response.GetResponseStream()

                       byte[] imagebyte;

                       using (MemoryStream ms = new MemoryStream())

                         {

                             imgstream.CopyTo(ms);

                               imagebyte =   ms.ToArray();

                         }

                         //Now convert imagebyte to file

                         //Attach product data and image in excel

    For multiple images you can attach those into notes and retrieve it while creaing Excel

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add image for product entity record and export it.

    You can try this.

    First retrieve the attachment

    msdn.microsoft.com/.../gg328429.aspx

    Then use Excel API to pass this file to target document

    stackoverflow.com/.../how-to-insert-a-picture-in-to-excel-from-c-sharp-app

    https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.shapes.addpicture.aspx

  • keyur7379 Profile Picture
    keyur7379 900 on at
    RE: Add image for product entity record and export it.

    Hello Grigoriy,

    Thanks for response.

    I need to export excel. Product record with it's attached image would display in excel file.

    Is it possible?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add image for product entity record and export it.

    Hello.

    You can add image as note's attachment on form entity.

    Export will be a little bit tricky.

    You'll need to retrieve noteId by regardingObjectId field from note entity, then retrieve attachment and create file from byte[].

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans