0

I can get the count of files in a root folder using this

pnp.sp.web.lists.getByTitle("Test").items.getAll().then((allItems) => {

    // how many did we get
    console.log(allItems.length);

}); 

But, how do I get the count of Items inside a Sub Folder?

For Instance

Suppose the Folder Test, contained the following sub-folders-

Test
   -Test-1
          -Test-1-1
           -Test-1-2
   -Test-2
   -Test-3

Test contains 3 folders-(Test-1, Test-2 and Test-3)

Test-1 contains two folders (Test-1-1 and Test-1-2)

How do I get the count of Test-1-1 using the above code?

0

I managed to solve it by using this logic

   pnp.sp.web.folders.getByName('Test').folders.getByName("Test-1").folders.getByName("Test-1-1").files.get().then((allItems) => {

            // how many did we get
            console.log(allItems.length);


        });
| improve this 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.