Skip to content

Commit 62274dc

Browse files
committed
paging issues from issue 5358
1 parent f206d20 commit 62274dc

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

powerapps-docs/developer/data-platform/fetchxml/page-results.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Page results using FetchXml
33
description: Learn how to use FetchXml to page results when you retrieve data from Microsoft Dataverse.
4-
ms.date: 02/29/2024
4+
ms.date: 08/09/2024
55
ms.reviewer: jdaly
66
ms.topic: how-to
77
author: pnghub
@@ -15,6 +15,7 @@ contributors:
1515
- dasussMS
1616
- apahwa-lab
1717
- DonaldlaGithub
18+
- tdashworth
1819
---
1920
# Page results using FetchXml
2021

@@ -143,7 +144,7 @@ static EntityCollection RetrieveAll(IOrganizationService service, string fetchXm
143144
// Set the fetch paging-cookie attribute with the paging cookie from the previous query
144145
fetchNode.SetAttributeValue("paging-cookie", results.PagingCookie);
145146

146-
fetchNode.SetAttributeValue("page", page++);
147+
fetchNode.SetAttributeValue("page", ++page);
147148
}
148149
return new EntityCollection(entities);
149150
}
@@ -529,7 +530,7 @@ You can adapt the [Quick Start: Web API sample (C#)](../webapi/quick-start-conso
529530
```csharp
530531
#region Web API call
531532

532-
string fetchXml = @"<fetch count='3' page='1'>
533+
string fetchXml = @"<fetch>
533534
<entity name='contact'>
534535
<attribute name='fullname'/>
535536
<attribute name='jobtitle'/>

powerapps-docs/developer/data-platform/org-service/queryexpression/page-results.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Page results using QueryExpression
33
description: Learn how to use QueryExpression to page results when you retrieve data from Microsoft Dataverse.
4-
ms.date: 05/12/2024
4+
ms.date: 08/09/2024
55
ms.reviewer: jdaly
66
ms.topic: how-to
77
author: pnghub
@@ -98,14 +98,19 @@ After each request, the method checks the [EntityCollection.MoreRecords property
9898
/// </summary>
9999
/// <param name="service">The authenticated IOrganizationService instance.</param>
100100
/// <param name="query">The QueryExpression query</param>
101+
/// <param name="page">The page size to use. Defaults to 5000</param>
101102
/// <returns>All the records that match the criteria</returns>
102-
static EntityCollection RetrieveAll(IOrganizationService service, QueryExpression query)
103+
static EntityCollection RetrieveAll(IOrganizationService service,
104+
QueryExpression query,
105+
int page = 5000)
103106
{
104107
// The records to return
105108
List<Entity> entities = new();
106109

107110
// Set the page
108111
query.PageInfo.PageNumber = 1;
112+
// Set the count
113+
query.PageInfo.Count = page;
109114

110115
while (true)
111116
{
@@ -150,10 +155,6 @@ static void Main(string[] args)
150155
QueryExpression query = new("contact")
151156
{
152157
ColumnSet = new ColumnSet("fullname", "jobtitle", "annualincome"),
153-
PageInfo = new PagingInfo() {
154-
// Set the page size
155-
Count = 25;
156-
},
157158
Orders = {
158159
{
159160
new OrderExpression(

0 commit comments

Comments
 (0)