Posts

Showing posts from August, 2014

Attachment File Data Truncated with QueryExpression.Distinct

Today, I am experiencing one strange issue regarding with the attachment file from CRM being corrupted upon downloading through the external web site.
That external web site is consuming the interface web service layer that CRM team implemented to perform CRUD and other specific data transactions.
But the problem is that the attachment files bigger than 2KB are always corrupted downloaded through that site.
Upon tracing the issue, I just found out that when Distinct property of the QueryExpressionis set to true, the "documentbody"  column in the "annotation" entity of the result set is truncated at the 2000 characters.

string entityName = "annotation"; Guid recordId = new Guid("00000000-0000-0000-0000-000000000000"); // one of the notes' GUID string field = "documentbody"; QueryExpression query = new QueryExpression(entityName); query.Criteria.AddCondition(new ConditionExpression(entityName + "id", ConditionOp…