Hi there,
Have a strange issue and I hoped that someone can help.
We have a CRM Queue with an assigned email address in our CRM system. In this queue, emails with XML attachments are received and I'm now creating a plugin to process the XML attachments.
I created a Post-Operation plugin on the "Create" message for the Queueitem entity. In my code I check if the new queue item is an email and then I use following code to look up all the attachments:
public EntityCollection GetAttachments(this IOrganizationService pService, Guid pInput) { QueryExpression qxprAtt = new QueryExpression(); qxprAtt.EntityName = "activitymimeattachment"; qxprAtt.ColumnSet = new ColumnSet(true); ConditionExpression cxprAtt = new ConditionExpression(); cxprAtt.AttributeName = "activityid"; cxprAtt.Operator = ConditionOperator.Equal; cxprAtt.Values.Add(pInput); FilterExpression fxprAtt = new FilterExpression(); fxprAtt.Conditions.Add(cxprAtt); qxprAtt.Criteria = fxprAtt; return pService.RetrieveMultiple(qxprAtt); }
When an email is received for that queue using the Exchange email router, the create queueitem plugin gets fired but the above code returns 0 attachments. If I open the mail in CRM, the XML attachment is there.
As a test I manually created a new email in CRM and added an XML as attachment. Then I added this email to the CRM queue using the email form button "add to queue" and now the above code returns 1 and the email gets processed correctly.
Anyone knows what is happening here?