{"id":12579,"date":"2025-01-13T05:00:00","date_gmt":"2025-01-13T04:00:00","guid":{"rendered":"https:\/\/sii.pl\/blog\/?p=12579"},"modified":"2025-01-16T15:48:33","modified_gmt":"2025-01-16T14:48:33","slug":"working-with-large-sharepoint-lists","status":"publish","type":"post","link":"https:\/\/sii.pl\/blog\/en\/working-with-large-sharepoint-lists\/","title":{"rendered":"Working with large SharePoint lists"},"content":{"rendered":"\n<p>While working with large SharePoint list, you have probably encountered the \u201cThe attempted operation is prohibited because it exceeds the list view threshold\u201d error. Let\u2019s take a close look at it and discuss how to go around this issue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Basic approach<\/strong><\/h2>\n\n\n\n<p>PnPjs documentation claims that getting items from a list is one of the basic actions that most applications require. It\u2019s hard to disagree with this statement.<\/p>\n\n\n\n<p>The straightforward way of getting elements would be using the&nbsp;<em>\/items<\/em>&nbsp;endpoint with the filter parameter. Either directly through REST API:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;GET] \/_api\/web\/lists\/getByTitle(\u2018Shipping Orders\u2019)\/items?$filter=InvoiceNo eq \u201801-2021A\u2019\n<\/pre><\/div>\n\n\n<p>Or via PnPjs library:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nawait sp.web.lists.getByTitle(&quot;Shipping Orders&quot;).items.filter(&quot;InvoiceNo eq \u201801-2021A\u2019&quot;)();\n<\/pre><\/div>\n\n\n<p>It works as expected until the list overgrows, and filtering requires too much processing power.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How SharePoint does it?<\/strong><\/h2>\n\n\n\n<p>A user can easily filter a large list manually:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/1-1.png\"><img decoding=\"async\" width=\"785\" height=\"412\" src=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/1-1.png\" alt=\"\" class=\"wp-image-18348\" srcset=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/1-1.png 785w, https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/1-1-300x157.png 300w, https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/1-1-768x403.png 768w\" sizes=\"(max-width: 785px) 100vw, 785px\" \/><\/a><figcaption class=\"wp-element-caption\">Pic. 1 Default list filtering<\/figcaption><\/figure>\n\n\n\n<p>In this case, SharePoint creates a request:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;POST]\n\n\/_api\/web\/GetListUsingPath(DecodedUrl=@a1)\/RenderListDataAsStream?@a1=&#039;\/sites\/Test\/Lists\/Shipping Orders&#039;&amp;amp;View=360f56cd-7b81-4912-abc1-7eea91134c24&amp;amp;TryNewExperienceSingle=TRUE&amp;amp;FilterField1=InvoiceNo&amp;amp;FilterValue1=01-2021A&amp;amp;FilterType1=Text\n<\/pre><\/div>\n\n\n<p>Payload:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n{\n  &quot;parameters&quot;: {\n    &quot;__metadata&quot;: {\n      &quot;type&quot;: &quot;SP.RenderListDataParameters&quot;\n    },\n    &quot;RenderOptions&quot;: 1183751,\n    &quot;AllowMultipleValueFilterForTaxonomyFields&quot;: true,\n    &quot;AddRequiredFields&quot;: true\n  }\n}\n<\/pre><\/div>\n\n\n<p>We can use the&nbsp;<em>\/RenderListDataAsStream<\/em>&nbsp;endpoint in our solution as well, but in slightly changed form.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>RenderListDataAsStream<\/strong><\/h2>\n\n\n\n<p>First of all, we need a query that filters our data. We\u2019re going to use Collaborative Application Markup Language aka CAML. It\u2019s based on XML and slightly resembles SQL. You may see its application in other SharePoint processes.<\/p>\n\n\n\n<p>You can&nbsp;<a href=\"https:\/\/sii.pl\/blog\/jezyk-caml-jako-jezyk-zapytan-do-list-sharepoint\/\" class=\"ek-link\">learn about CAML<\/a>&nbsp;in another blog post.<\/p>\n\n\n\n<p>Our query would look like this:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;View&gt;\n  &amp;lt;RowLimit Paged=&quot;TRUE&quot;&gt;100&amp;lt;\/RowLimit&gt;\n  &amp;lt;Query&gt;\n    &amp;lt;Where&gt;\n      &amp;lt;Eq&gt;\n        &amp;lt;FieldRef Name=&quot;InvoiceNo&quot;\/&gt;\n        &amp;lt;Value Type=&quot;Text&quot;&gt;01-2021A&amp;lt;\/Value&gt;\n      &amp;lt;\/Eq&gt;\n    &amp;lt;\/Where&gt;\n    &amp;lt;OrderBy&gt;\n      &amp;lt;FieldRef Name=&quot;ID&quot; Ascending=&quot;TRUE&quot; \/&gt;\n    &amp;lt;\/OrderBy&gt;\n  &amp;lt;\/Query&gt;\n&amp;lt;\/View&gt;\n<\/pre><\/div>\n\n\n<p>Let\u2019s start from the top:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;RowLimit Paged=&quot;TRUE&quot;&gt;100&amp;lt;\/RowLimit&gt;\n<\/pre><\/div>\n\n\n<p>\u201cRowLimit\u201d sets the number of items returned by SharePoint. \u201cPaged\u201d property specifies if we want to get more items page by page. In our case, we will get data in chunks of 100.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;Eq&gt;\n  &amp;lt;FieldRef Name=&quot;InvoiceNo&quot;\/&gt;\n  &amp;lt;Value Type=&quot;Text&quot;&gt;01-2021A&amp;lt;\/Value&gt;\n&amp;lt;\/Eq&gt;\n<\/pre><\/div>\n\n\n<p>\u201cEq\u201d is one of many comparison operators. It simply means \u201cequal to\u201d. To be exact \u2013 we\u2019re looking for items which invoice number (<em>&lt;FieldRef Name=\u201dInvoiceNo\u201d\/&gt;<\/em>) is equal to (<em>&lt;Eq&gt;<\/em>) \u201c01-2021A\u201d (<em>&lt;Value Type=\u201dText\u201d&gt;01-2021A&lt;\/Value&gt;<\/em>).<\/p>\n\n\n\n<p>More operators can be found&nbsp;<a href=\"https:\/\/docs.microsoft.com\/en-us\/sharepoint\/dev\/schema\/query-schema\" rel=\"nofollow\" >in the official documentation<\/a>.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;OrderBy&gt;\n  &amp;lt;FieldRef Name=&quot;ID&quot; Ascending=&quot;TRUE&quot; \/&gt;\n&amp;lt;\/OrderBy&gt;\n<\/pre><\/div>\n\n\n<p>\u201cOrderBy\u201d determines how filtered items should be sorted. We\u2019re making sure that our data is ordered by ID and that it goes from smaller to bigger values.<\/p>\n\n\n\n<p>Let\u2019s put it all together.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nawait sp.web.lists.getByTitle(&quot;Shipping Orders&quot;).renderListDataAsStream({\n   ViewXml: `&amp;lt;View&gt;\n   &amp;lt;RowLimit Paged=&quot;TRUE&quot;&gt;100&amp;lt;\/RowLimit&gt;\n      &amp;lt;Query&gt;\n        &amp;lt;Where&gt;\n          &amp;lt;Eq&gt;\n            &amp;lt;FieldRef Name=&quot;InvoiceNo&quot;\/&gt;\n            &amp;lt;Value Type=&quot;Text&quot;&gt;01-2021A&amp;lt;\/Value&gt;\n          &amp;lt;\/Eq&gt;\n        &amp;lt;\/Where&gt;\n        &amp;lt;OrderBy&gt;\n          &amp;lt;FieldRef Name=&quot;ID&quot; Ascending=&quot;TRUE&quot; \/&gt;\n        &amp;lt;\/OrderBy&gt;\n      &amp;lt;\/Query&gt;\n    &amp;lt;\/View&gt;`\n  });\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;POST] \/_api\/web\/lists\/getByTitle(&#039;Shipping Orders&#039;)\/RenderListDataAsStream\n<\/pre><\/div>\n\n\n<p>Payload:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n{\n  &quot;parameters&quot;: {\n    &quot;__metadata&quot;: {\n      &quot;type&quot;: &quot;SP.RenderListDataParameters&quot;\n    },\n    &quot;ViewXml&quot;: &quot;\\n    &amp;lt;View&gt; \\n    &amp;lt;RowLimit Paged=\\&quot;TRUE\\&quot;&gt;100&amp;lt;\/RowLimit&gt;\\n      &amp;lt;Query&gt;\\n        &amp;lt;Where&gt;\\n          &amp;lt;Eq&gt;\\n            &amp;lt;FieldRef Name=\\&quot;InvoiceNo\\&quot;\/&gt;\\n            &amp;lt;Value Type=\\&quot;Text\\&quot;&gt;01-2021A&amp;lt;\/Value&gt;\\n          &amp;lt;\/Eq&gt;\\n        &amp;lt;\/Where&gt;\\n        &amp;lt;OrderBy&gt;\\n          &amp;lt;FieldRef Name=\\&quot;ID\\&quot; Ascending=\\&quot;TRUE\\&quot; \/&gt;\\n        &amp;lt;\/OrderBy&gt;\\n      &amp;lt;\/Query&gt;\\n    &amp;lt;\/View&gt;\\n\\n&quot;\n  }\n}\n<\/pre><\/div>\n\n\n<p>And SharePoint\u2019s response:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n{\n   CurrentFolderSpItemUrl: &quot;&quot;,\n   FilterLink: &quot;?&quot;,\n   FirstRow: 1,\n   FolderPermissions: &quot;0x7ffffffffffbffff&quot;,\n   ForceNoHierarchy: &quot;1&quot;,\n   HierarchyHasIndention: &quot;&quot;,\n   LastRow: 100,\n   NextHref: &quot;?Paged=TRUE&amp;amp;p_ID=2152&amp;amp;PageFirstRow=101&amp;amp;View=00000000-0000-0000-0000-000000000000&quot;,\n   Row: &#x5B;items],\n   RowLimit: 100,\n}\n<\/pre><\/div>\n\n\n<p>We can find an array of filtered items under the \u201cRow\u201d property.<\/p>\n\n\n\n<p>Since we requested our data in chunks, we got first set of items that meet our criteria. The next batch of elements is available under&nbsp;<em>\/RenderDataAsStream<\/em>&nbsp;endpoint with a special href that can be found under \u201cNextHref\u201d property \u2013 \u201c?Paged=TRUE&amp;p_ID=2152&amp;PageFirstRow=101&amp;View=00000000-0000-0000-0000-000000000000\u201d.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nawait sp.web.lists.getByTitle(&quot;Shipping Orders&quot;).renderListDataAsStream({\n    ViewXml: viewXml,\n    Paging: &quot;Paged=TRUE&amp;amp;p_ID=2152&amp;amp;PageFirstRow=101&amp;amp;View=00000000-0000-0000-0000-000000000000&quot;,\n  });\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;POST] \/_api\/web\/lists\/getByTitle(&#039;Shipping Orders&#039;)\/RenderListDataAsStream\n<\/pre><\/div>\n\n\n<p>Payload:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n{\n  &quot;parameters&quot;: {\n    &quot;__metadata&quot;: {\n      &quot;type&quot;: &quot;SP.RenderListDataParameters&quot;\n    },\n    &quot;ViewXml&quot;: &quot;&amp;lt;View&gt; \\n    &amp;lt;RowLimit Paged=\\&quot;TRUE\\&quot;&gt;100&amp;lt;\/RowLimit&gt;\\n      &amp;lt;Query&gt;\\n        &amp;lt;Where&gt;\\n          &amp;lt;Eq&gt;\\n            &amp;lt;FieldRef Name=&#039;InvoiceNo&#039; \/&gt;\\n            &amp;lt;Value Type=&#039;Text&#039;&gt;1-2021&amp;lt;\/Value&gt;\\n          &amp;lt;\/Eq&gt;\\n        &amp;lt;\/Where&gt;\\n      &amp;lt;\/Query&gt;\\n    &amp;lt;\/View&gt;&quot;,\n    &quot;Paging&quot;: &quot;Paged=TRUE&amp;amp;p_ID=2152&amp;amp;ix_Paged=TRUE&amp;amp;ix_ID=2152&amp;amp;PageFirstRow=101&amp;amp;View=00000000-0000-0000-0000-000000000000&quot;\n  }\n}\n<\/pre><\/div>\n\n\n<p>If the \u201cNextHref\u201d property is missing from the result, all data was already requested and returned.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Important elements of RenderListDataAsStream approach<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Indexing<\/strong><\/h3>\n\n\n\n<p>SharePoint presents an idea of column indexing. It\u2019s a way of increasing the performance of loading list views. Simply put \u2013 SharePoint \u201cis aware\u201d of indexed data and doesn\u2019t have to loop through all items to find it. And that exactly what we need!<\/p>\n\n\n\n<p>This concept can be especially useful if you\u2019re getting data through<em>&nbsp;\/RenderListDataAsStream<\/em>&nbsp;endpoint and still get the threshold error. Try adding indices to columns that you use in your queries. You can do this manually in the List Settings page in the Columns section. Alternatively, you can update the \u201cIndexed\u201d flag on a column via PowerShell script.<\/p>\n\n\n\n<p>SharePoint list can have up to 20 indices. Unfortunately, not all column types can be indexed, including:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>multiple lines of text,<\/li>\n\n\n\n<li>choice (multi-valued),<\/li>\n\n\n\n<li>calculated,<\/li>\n\n\n\n<li>hyperlink or picture,<\/li>\n\n\n\n<li>custom columns,<\/li>\n\n\n\n<li>person or group (multi-valued),<\/li>\n\n\n\n<li>external data.<\/li>\n<\/ul>\n\n\n\n<p>Other types:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>single line of text,<\/li>\n\n\n\n<li>choice (single value),<\/li>\n\n\n\n<li>number,<\/li>\n\n\n\n<li>currency,<\/li>\n\n\n\n<li>date and time,<\/li>\n\n\n\n<li>person or group (single value),<\/li>\n\n\n\n<li>managed metadata,<\/li>\n\n\n\n<li>yes\/no,<\/li>\n\n\n\n<li>lookup<\/li>\n<\/ul>\n\n\n\n<p>can be easily indexed.<\/p>\n\n\n\n<p><a href=\"https:\/\/support.microsoft.com\/en-us\/office\/add-an-index-to-a-list-or-library-column-f3f00554-b7dc-44d1-a2ed-d477eac463b0\" rel=\"nofollow\" >More about indexing<\/a>&nbsp;can be found in Microsoft resources.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>RowLimit<\/strong><\/h3>\n\n\n\n<p>As mentioned before, \u201cRowLimit\u201d property defines how many items will be returned and whether they\u2019re paged. It\u2019s important too look into this option, especially when you try to retrieve more items than the view threshold. For instance, my list has a default limitation of 5000 elements for a list view.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/2-1.png\"><img decoding=\"async\" width=\"892\" height=\"132\" src=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/2-1.png\" alt=\"\" class=\"wp-image-18350\" srcset=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/2-1.png 892w, https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/2-1-300x44.png 300w, https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/2-1-768x114.png 768w\" sizes=\"(max-width: 892px) 100vw, 892px\" \/><\/a><figcaption class=\"wp-element-caption\">Pic. 2 List settings<\/figcaption><\/figure>\n\n\n\n<p>If my query filters out more items that that, the threshold error will be returned. If I paged my results:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;RowLimit Paged=&quot;TRUE&quot;&gt;100&amp;lt;\/RowLimit&gt;\n<\/pre><\/div>\n\n\n<p>I can get all the items that meet my criteria, even if there are over 5 000 of them.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Scopes<\/strong><\/h3>\n\n\n\n<p>The scope is a property of the \u201cView\u201d section of the query.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;View Scope=&quot;RecursiveAll&quot;&gt;\n<\/pre><\/div>\n\n\n<p>It defines what kind of items will be included in the result and how deep the query will look in the list structure. If omitted, the option will be set for \u201cDefault\u201d \u2013 only&nbsp;<strong>items<\/strong>&nbsp;in the list<strong>&nbsp;root folder&nbsp;<\/strong>will be taken into account. Some other scopes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>All \u2013 looks for&nbsp;<strong>items and folders<\/strong>&nbsp;in the&nbsp;<strong>root folder<\/strong>,<\/li>\n\n\n\n<li>Recursive \u2013 looks for&nbsp;<strong>items<\/strong>&nbsp;in&nbsp;<strong>the root folder and inside the subfolders<\/strong>,<\/li>\n\n\n\n<li>RecursiveAll \u2013 looks for&nbsp;<strong>items and folders<\/strong>&nbsp;in<strong>&nbsp;the root folder and in the subfolders<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p>You should focus on the \u201cscope\u201d setting if you have folders in your lists structure. If the property is not defined correctly, some data may not be included in the results.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Using existing list views<\/strong><\/h2>\n\n\n\n<p>We built all filters by ourselves in the examples above. That\u2019s a great practise when our query is dynamically changing. However, when the filter values are constant, we could take another approach. We can use schema of list view that already exists.<\/p>\n\n\n\n<p>To create a list view, we go to the Views section on the List Settings page. We could define:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>columns presented on the view,<\/li>\n\n\n\n<li>sorting of the items,<\/li>\n\n\n\n<li>filtering of the items,<\/li>\n<\/ul>\n\n\n\n<p>and some more settings.<\/p>\n\n\n\n<p>In my case, I need a view that filters orders marked as \u201cSent\u201d. I manually create a view with corresponding settings.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/3-1.png\"><img decoding=\"async\" width=\"269\" height=\"123\" src=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/02\/3-1.png\" alt=\"\" class=\"wp-image-18352\"\/><\/a><figcaption class=\"wp-element-caption\">Pic. 3 List view settings<\/figcaption><\/figure>\n\n\n\n<p>Now, I can use this view\u2019s XML schema in my code.<\/p>\n\n\n\n<p>Firstly, I\u2019ll get the view definition.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nawait await sp.web.lists.getByTitle(&quot;Shipping Orders&quot;).views.getByTitle(&quot;Sent Orders&quot;)();\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;GET] \/_api\/web\/lists\/getByTitle(&#039;Shipping Orders&#039;)\/views\/getByTitle(&#039;Sent Orders&#039;)\n<\/pre><\/div>\n\n\n<p>And then retrieve the data using the view\u2019s schema.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nawait sp.web.lists.getByTitle(&quot;Shipping Orders&quot;).renderListDataAsStream({\n    ViewXml: existingView.ListViewXml,\n  });\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\"><strong>Building XMLs with external libraries<\/strong><\/h2>\n\n\n\n<p>Building custom view definitions can be tedious. To speed up the process, we could use some external libraires.&nbsp;<a href=\"https:\/\/github.com\/andrei-markeev\/camljs\" rel=\"nofollow\" >My personal favorite is CamlJs.<\/a><\/p>\n\n\n\n<p>Firstly, we create the builder object:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst camlBuilder = new CamlBuilder();\n<\/pre><\/div>\n\n\n<p>Then we build the query:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconst viewXml = camlBuilder.Where()\n    .ChoiceField(&quot;ShippingStatus&quot;).In(&#x5B;\u201cSent\u201d, \u201cReceived\u201d])\n    .And()\n    .DateField(&quot;ShippingDate&quot;)\n    .LessThanOrEqualTo(CamlBuilder.CamlValues.Now)\n    .OrderByDesc(&quot;ID&quot;)\n    .ToString();\n<\/pre><\/div>\n\n\n<p>And use it as before:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nawait sp.web.lists.getByTitle(&quot;Shipping Orders&quot;).renderListDataAsStream({\n    ViewXml: viewXml\n  });\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\"><strong>Special parameters that we should be aware of<\/strong><\/h2>\n\n\n\n<p>The definitions of view XML and paging are two of the&nbsp;<em>\/RenderListData<\/em>&nbsp;<strong>parameters<\/strong>. The parameters are optional, but you should definitely be aware that they exist. Most of them are self-explanatory:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>AddRequiredFields,<\/li>\n\n\n\n<li>AllowMultipleValueFilterForTaxonomyFields,<\/li>\n\n\n\n<li>DatesInUtc,<\/li>\n\n\n\n<li>ExpandGroups,<\/li>\n\n\n\n<li>FirstGroupOnly,<\/li>\n\n\n\n<li>FolderServerRelativeUrl,<\/li>\n\n\n\n<li>ImageFieldsToTryRewriteToCdnUrls,<\/li>\n\n\n\n<li>OverrideViewXml,<\/li>\n\n\n\n<li>RenderOptions,<\/li>\n\n\n\n<li>ReplaceGroup.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>FolderServerRelativeUrl<\/strong><\/h2>\n\n\n\n<p>SharePoint will run our quires in the root folder of the list by default. To change that, we can define the FolderServerRelativeUrl parameter. \u201cServer relative\u201d means that the URL should start from the&nbsp;<em>\/sites\/<\/em>&nbsp;part. For instance: \u201c\/sites\/Test\/Lists\/Shipping Orders\/Europe\u201d. This way API will look for items only in the \u201cEurope\u201d folder.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/sii.pl\/oferty-pracy\/\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"737\" height=\"170\" src=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2025\/01\/praca-k-EN-2.jpg\" alt=\"job offers\" class=\"wp-image-30099\" srcset=\"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2025\/01\/praca-k-EN-2.jpg 737w, https:\/\/sii.pl\/blog\/wp-content\/uploads\/2025\/01\/praca-k-EN-2-300x69.jpg 300w\" sizes=\"(max-width: 737px) 100vw, 737px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">RenderOptions<\/h2>\n\n\n\n<p>Beside the list items, SharePoint can return some other information, for instance: list schema, view metadata, media URLs or some data about files and folders. To define what we need, we should set up the RenderOptions parameter.<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/sharepoint\/dev\/sp-add-ins\/working-with-lists-and-list-items-with-rest#sprenderlistdataoptions-options\" rel=\"nofollow\" >Specific description of the options<\/a>&nbsp;can be found in the official documentation.<\/p>\n\n\n\n<p>***<\/p>\n\n\n\n<p>The article was first published on 11.02.2022<\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-left kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;left&quot;,&quot;id&quot;:&quot;12579&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;21&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;11&quot;,&quot;greet&quot;:&quot;&quot;,&quot;legend&quot;:&quot;5\\\/5 ( votes: 21)&quot;,&quot;size&quot;:&quot;18&quot;,&quot;title&quot;:&quot;Working with large SharePoint lists&quot;,&quot;width&quot;:&quot;139.5&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} ( {votes}: {count})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 139.5px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 11px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 18px; height: 18px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 14.4px;\">\n            5\/5 ( votes: 21)    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>While working with large SharePoint list, you have probably encountered the \u201cThe attempted operation is prohibited because it exceeds the &hellip; <a class=\"continued-btn\" href=\"https:\/\/sii.pl\/blog\/en\/working-with-large-sharepoint-lists\/\">Continued<\/a><\/p>\n","protected":false},"author":546,"featured_media":12763,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_editorskit_title_hidden":false,"_editorskit_reading_time":5,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","inline_featured_image":false,"footnotes":""},"categories":[1320],"tags":[1345,1346,1361,1347],"class_list":["post-12579","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hard-development","tag-sharepoint-en","tag-office-365-en","tag-microsoft-en","tag-pnp-en"],"acf":[],"aioseo_notices":[],"republish_history":[],"featured_media_url":"https:\/\/sii.pl\/blog\/wp-content\/uploads\/2022\/01\/Working-with-large-SharePoint-lists.png","category_names":["Hard development"],"_links":{"self":[{"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/posts\/12579"}],"collection":[{"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/users\/546"}],"replies":[{"embeddable":true,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/comments?post=12579"}],"version-history":[{"count":3,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/posts\/12579\/revisions"}],"predecessor-version":[{"id":30101,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/posts\/12579\/revisions\/30101"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/media\/12763"}],"wp:attachment":[{"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/media?parent=12579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/categories?post=12579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sii.pl\/blog\/en\/wp-json\/wp\/v2\/tags?post=12579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}