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 you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.