Skip to main content

Notifications

Announcements

No record found.

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

}

  • Pankaj Gogoi Profile Picture
    Pankaj Gogoi 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans