4

I want to retrieve Subfolders using SP REST API and check if there is any created folder and If it exists, display HTML content like: <label>SubFolder Title</label> for each SubFolder. All dynamically. Can someone help me?

Ex:

  • Folder Level 1
    • Folder Level 1.1
      • Folder Level 1.1.1
  • Folder Level 2
    • Folder Level 2.2
  • Folder Level 3

1 Answer 1

0

Have you tried something like this?

/_api/web/lists/getbytitle('Documents')/items?$expand=Folder&$select=Title,Folder/ServerRelativeUrl

It'll return a path, which than could be split and represented the way you need to.

/sites/Testing/Shared Documents/Parent Docs

/sites/Testing/Shared Documents/Parent Docs/Child Docs

/sites/Testing/Shared Documents/Parent Docs/Child Docs

/sites/Testing/Shared Documents/Parent Docs/Child Docs/Child Docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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