Microsoft Dynamics CRM

{Advanced XRM DEVELOPMENT}Retrieve entity image url for crm 2013/2015

Sometimes we get requirement to find the url of image field on record. Considering example of contacts , here is the example to retrieve the URL below:

QueryByAttribute query = new QueryByAttribute(“contact”);

query.ColumnSet = new ColumnSet(“entityimage_url”);

query.Attributes.AddRange(“lastname”);

query.Values.AddRange(“sample”);

EntityCollection binaryImageResults = _service.RetrieveMultiple(query);

foreach (var record in binaryImageResults.Entities)

{

     String recordName = record.Attributes[“entityimage_url”].ToString();

     Console.WriteLine(recordName);

}

Hope it helps!

Advertisements

1 thought on “{Advanced XRM DEVELOPMENT}Retrieve entity image url for crm 2013/2015”

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s