1

Microsoft Documentation is providing filter operator which takes greater than, less than or equal to but it is working?

RenderListDataAsStream URI parameters

The documentation says we can use filterOP, filterField, filterValue that can be used for filtering, so I have used filterField1=created&filterValue1={startDate}&filterOp1=Geq&filterField2=created&filterValue2={endDate}&filterOp1=Leq to get the items created between start date and end date but it is not working.

0

You can filter list items using CAML query when fetching list items using RenderListDataAsStream endpoint.

You can pass the CAML query to POST API like below example:

POST: https://<tenant>.sharepoint.com/sites/<site-name>/_api/web/Lists(guid'<list-guid>')/RenderListDataAsStream

Body: {
  "parameters": {
    "RenderOptions": 2, // ListData
    "ViewXml": "<View>
                  <ViewFields>
                    <FieldRef Name=\"ValoNavigation\"/>
                  </ViewFields>
                  <Query>
                    <Where>
                      <Eq>
                        <FieldRef Name=\"ID\"/>
                        <Value Type=\"Number\">1</Value>
                      </Eq>
                    </Where>
                  </Query>
                  <RowLimit Paged=\"TRUE\">1</RowLimit>
                </View>"
  }
}

Source: Using the SharePoint RenderListDataAsStream API to fetch lookup and single managed metadata field values

You can find more information about CAML query schema at: Query Schema


For date range CAML query examples, check below links:

  1. CAML Query: filter items between dates
  2. CAML Query filtering data within a date range
3
  • Thank you for answering my question @Ganesh, But I need to use only query parameters – Ram Girish Karri May 25 at 4:21
  • I haven't tried using query parameters. But the "Marc Anderson" also mentioned in one of his blog: "I also can’t get filters to work using the FilterOp1-10 parameters, nor do several other of the parameters do what I would expect, and I can’t find ANY examples (other than the ones in the documentation page, which really don’t cover anything useful) showing how to use this endpoint.". So if you want you can try using CAML query & see if it works for you! – Ganesh Sanap May 25 at 5:01
  • But why did Microsoft documentation "docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/…" mentioned the filter op operator – Ram Girish Karri May 26 at 17:16
0

REST API with date range parameters works for me in SPO/SPFx. Just make sure date range is formatted correctly. Here is an example:

https://MysharePoint.tenant.com/sites/siteColl/_api/web/lists/GetByTitle('myLibrary')/items?$top=5000&$Select=ID, Title, AssignedTo/Title, AssignedTo/EMail, Modified,Created&$Expand=AssignedTo/Id&$filter=(created%20ge%20datetime'2021-5-23T00:00:00' and created%20le%20datetime'2021-5-24T00:00:00')

1
  • OP specifically asked for RenderListDataAsStream endpoint API. – Ganesh Sanap May 24 at 19:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.