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

Notifications

Announcements

No record found.

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

    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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 57 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 34 Most Valuable Professional

#3
Scott Jackson UK Profile Picture

Scott Jackson UK 22

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans