Dynamics CRM 获取图像类型字段
作者:互联网
Dynamics CRM 如何获取图像类型字段的值
在需要获取某个实体的图像字段时,通常的做法是返回Base64的文本;
系统默认的图像字段通过QueryExpression是无法查到的,只能通过fetchxml构建的方式查询;
string fetchxml = string.Format(@"<fetch version='1.0' output-format='xml-platform' mapping='logical'>
<entity name='contact'>
<attribute name='image' />//图像字段
</entity>
</fetch>", id.ToString());
FetchExpression expression = new FetchExpression(fetchxml);
EntityCollection collection = service.RetrieveMultiple(expression);
string image = collection.Entities[0].TryGetAttributeValue<byte[]>("vy_image",out byte[] imageByte) ? "data:image/png;base64," + Convert.ToBase64String(imageByte) :"";
标签:FetchExpression,string,image,fetchxml,图像,Dynamics,CRM 来源: https://www.cnblogs.com/askquestionsandlearn/p/16379803.html