0

I'm trying to find a way to do this: create a tree view of all items in the "Documents" library, with folders, subfolders, and items (links to items).

Im using _api fo get folders an files

_api/Web/GetFolderByServerRelativeUrl('folderRelativeUrl')?$expand=Folders,Files

all i get is the folders and the name of the files ! not all files but files in the root.

I want the result in treeView or Array

Example: For a Documents library created as this :

Folder 1 Folder 1.1 Folder 2 Folder 2.1 text.txt Folder 3

2

Try

/_api/web/Lists/GetByTitle('Documents')/Items?$select=FileLeafRef,FileRef

You will have to built the correct tree structure yourself

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.