Asked by:
I wouldretrieve the image of the product

Question
-
In product esisteEntityImageId but it is null; instead EntityImage_URL is similar:
https://myorg.crm.dynamics.com/image/download.aspx?attribute=entityimage&entity=contact&id={ECB6D3DF-4A04-E311-AFE0-00155D9C3020}×tamp=635120312218444444
I would like to save the image of a product of a crm com png, how can I do?Monday, January 19, 2015 3:19 PM
All replies
-
Hello,
Recheck following article - http://msdn.microsoft.com/en-us/library/dn511697.aspx
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blogMonday, January 19, 2015 4:23 PMModerator -
I take this FETCH but the result does not contain the field enityimage ...because
string imageUrlQuery = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
"<entity name='product'>" +
"<attribute name='name'/>" +
"<attribute name='entityimage'/>" +
"</entity>" +
"</fetch>";
foreach (var single_image in xrm.RetrieveMultiple(new FetchExpression(imageUrlQuery)).Entities)
{
byte[] imageBytes = (byte[])(single_image.Attributes["entityimage"]);
MemoryStream ms = new MemoryStream(imageBytes);
Image img = Image.FromStream(ms);
img.Save("url");
}Friday, January 23, 2015 11:09 AM -
Hello,
Is there any chance that all products don't have image field populated? In case field is empty it is not returned in collection.
Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blogFriday, January 23, 2015 11:53 AMModerator -
the product have the imageFriday, January 23, 2015 12:07 PM
-
the product have the image
I believe there are no miracles exist. I provided you with code that tested and works and now ball on your side. I can't help you more.Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
My blogFriday, January 23, 2015 12:11 PMModerator