1

I have my wiki page library files organized into folders and subfolders. I want to create a welcome page that shows this, in this sort of manner:

  • Wiki
    • Folder
      • Subfolder
        • Subfolder Page
      • Folder Page
      • Folder Page

And so on (the dots aren't necessary, just trying to give an idea of depth to show what I mean). Manually, I could create this, but the time and effort for upkeep would be extreme. What I would like is something like a web part that would scan the wiki page library (database or however) and populate this info in this simple manner on the welcome page. I'm using sharepoint online

Can anyone help?

0

you have to use JSOM to recursively call folders and pages in the folders.

JSOM Common operations

  • Sorry about the late reply, but your answer helped move me along the path that works. Unfortunately (and I could have missed it, please feel free to correct me) I saw no native JSOM recursion and had to develop my own recursive functions. I did add an upvote as you helped me along. – Leonastas Apr 12 '16 at 21:37
  • off course there would not be a native recursive function, you read the API and create your function, another way is to you CAML query to get all folders and pages. CAML supports recursive iteration. – Ali Apr 13 '16 at 3:55
0

The only way I've found that consistently works in this case is to use JSOM in a function and get a list of folders in the folder and then recursively call a function that relies on this listing, passing current path along during each recursive call.
Pseudo-code example

function getfolders(path)
{
 somejsomcalls
 return foldersinpath
}
function getfiles(path)
{
 somejsomcalls
 return filersinpath
}

function buildlist(path)
{
 curfolder = somejsomtoretreivecurrentfolderinfo(path)
 *add some HTML to build list* 
 folders = getfolders(path)
 files = getfiles(path)
 foreach (folder in folders)
 {
  buildlist(path\folder)
 }
 foreach (file in files)
 {
  *some html to add the files to list*
 }
} 

If needed/desired I can post an example code of what I have working, if this doesn't explain well enough. Also, if someone has a better answer, please post and I will gladly mark you as answer.

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.