0

The code snippet I have below is retrieving all documents in one document library inside one site.

I want to be able to retrieve all documents inside all document library's inside all my sites/tenancy.

  public getDocuments() {
    axios 
    .get("https://bpdev.sharepoint.com/sites/KIM/_api/lists/getbytitle('MyList2')/items?$select=*,FileRef",
            { params:{},
              headers: { 'accept': 'application/json;odata=verbose' }
            })
    .then(response => {
      this.setState({
        documents: response.data.d.results
      });
    })
    .catch(error => {
      console.log(error);
    });
  }

Any idea how to update my endpoint to do so?

0

you can use search to get all document by contentTypeId

/_api/search/query?querytext='ContentTypeId:0x0101*'&selectproperties='FileRef'

  • This does not seem to return the documents I have in the document librarys. Such as .csv or .txt files? – BennKingy Nov 21 at 13:48

Your Answer

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

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