I had written code to get the emails record in crm online, however if the records are more than 50K, error will be thrown. Is there a way to get all the emails records without running into exception (Exception error: "AggregateQueryRecordLimit exceeded. Cannot perform this operation.")?
code snippet:
string returnstatus = "";
var xmlAllemails = @"
<fetch distinct='false' mapping='logical' aggregate='true'>
<entity name='email'>
<attribute name='subject' alias='subject_count' aggregate='count'/>
</entity>
</fetch>";
int countAllemails = 0;
try
{
var resultAllemails = _service.RetrieveMultiple(
new FetchExpression(xmlAllemails)).Entities.First();
countAllemails = (int)resultAllemails
.GetAttributeValue<Microsoft.Xrm.Sdk.AliasedValue>("subject_count").Value;
}
.....
........
*This post is locked for comments