web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Unanswered

One or more errors occurred. (Malformed XML in the Paging Cookie)

(0) ShareShare
ReportReport
Posted on by 5

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

}

I have the same question (0)
  • Pankaj Gogoi Profile Picture
    3,177 on at
    RE: One or more errors occurred. (Malformed XML in the Paging Cookie)

    Hi SHG,

    If it's possible please put the paging cookie data so that we can analyze.

    There could be data having special characters like "&". You can take the paging cookie value and decode it to see if the XML is generated without any issue.

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/page-large-result-sets-with-fetchxml

    Best Regards

    PG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 60

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 16 Super User 2025 Season 2

#2
CU29080825-0 Profile Picture

CU29080825-0 16

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans