Hello,
I try to get all the marketing lists that belong to an campaignactivity. I did the exact same thing using the 4.0 endpoint where it worked fine. Now, using 2011 endpoint, I get the exception below. Can someone help me? What am I doing wrong?
var qeListsOnCampaignActivity = new QueryExpression();
qeListsOnCampaignActivity = new QueryExpression()
{
EntityName = List.EntityLogicalName,
ColumnSet = new ColumnSet(true),
LinkEntities =
{
new LinkEntity
{
LinkFromEntityName = List.EntityLogicalName,
LinkFromAttributeName = string.Format("{0}id", List.EntityLogicalName.ToLower()),
LinkToEntityName = CampaignActivityItem.EntityLogicalName,
LinkToAttributeName = "itemid",
LinkCriteria = new FilterExpression
{
Conditions =
{
new ConditionExpression
{
AttributeName = string.Format("{0}id", "activity"),
Operator = ConditionOperator.Equal,
Values = { campaignActivityId }
}
}
}
}
},
Criteria = new FilterExpression
{
FilterOperator = LogicalOperator.And,
Conditions =
{
new ConditionExpression
{
AttributeName = "statecode",
Operator = ConditionOperator.Equal,
Values = { "Active" }
}
}
}
};
Create the request object.
Set the properties of the request object.
var retrieve = new RetrieveMultipleRequest { Query = qeListsOnCampaignActivity };
Execute the request.
var retrieved = (RetrieveMultipleResponse)_crmHelper.OrganizationService.Execute(retrieve);
=>
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter schemas.microsoft.com/.../Services:request. The InnerException message was 'Error in line 1 position 1733. Element 'schemas.microsoft.com/.../Arrays:anyType& contains data from a type that maps to the name 'schemas.microsoft.com/.../Arrays:ArrayOfanyType&. The deserializer has no knowledge of any type that maps to this name. Consider changing the implementation of the ResolveName method on your DataContractResolver to return a non-null value for name 'ArrayOfanyType' and namespace 'schemas.microsoft.com/.../Arrays&. Please see InnerException for more details.