Hi All,
I am trying to fetch more than 5k records using fetch xml from CRM using web api.
I am experiencing the below error. Can anyone assist me where i am doing wrong.
System.AggregateException: One or more errors occurred. (Malformed XML in the Paging Cookie)
---> CoreAPI.CRM.Classes.ServiceException: Malformed XML in the Paging Cookie
.
I am using this code to fetch second request in CRM
if (response.Contains("@Microsoft.Dynamics.CRM.fetchxmlpagingcookie"))
{
var myDtoObject = JsonConvert.DeserializeObject<GenericDto<Account>>(response);
XmlDocument doc = new XmlDocument();
doc.LoadXml(myDtoObject.Cookie);
XmlElement root = doc.DocumentElement;
pagingCookie = root.Attributes["pagingcookie"].Value;
string s = root.Attributes["pagingcookie"].Value;
pagingCookie = GetDecodedCookie(s);
//calling the request with incre pagenumber and pagingcookie
}