0

I am trying to retrieve the items from list using restapi with camlquery in SPFx solution but i am not able to get the items because of the thershold. How to overcome. The code like below.

let viewXML = list.ListViewXml;
        let tempviewXML = viewXML;
        let indexOfRowLimit = tempviewXML.indexOf("<RowLimit");
        let trimmedString = tempviewXML.substring(0, indexOfRowLimit);
        trimmedString = trimmedString + "<RowLimit>5000</RowLimit></View>";
        viewXML = trimmedString;
const options: ISPHttpClientOptions = {
          headers: { "odata-version": "3.0" },
          body: `{'query': {
                '__metadata': {'type': 'SP.CamlQuery'},
        'ViewXml': '${viewXML}'
            }}`
        };
        receivedProps.ctx.spHttpClient
          .post(
            `${receivedProps.siteUrl}/_api/Web/Lists/getById('${listId}')/GetItems?$expand=FieldValuesAsText`,
            SPHttpClient.configurations.v1,
            options
          )
          .then(data => {})

Thanks in Advance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.