Does anyone have some reference on why I'm unable to pull in files from a folder in SharePoint?

This is what I have so far, this will be my PnP js call (I don't I'm not doing something right) enter image description here

        baseUrl: "https://fh126cloud.sharepoint.com/bdm/business-development/"

    var folderUrl = 'https://fh126cloud.sharepoint.com/bdm/business-development/';

    let getFiles = (folderUrl) => {
        $pnp.sp.web.getFolderByServerRelativeUrl(folderUrl).expand("Folders, Files").get().(r => {
        r.Folders.forEach(item => {
        r.Files.forEach(item => { 
        var $table = linkModal(items);
        $('#' + id).html($table);

    function linkModal(items) {
        var table = $('');
        items.forEach(item => {
        return table;
    getFiles("/Style Library");

I'm wanting it placed in this modal between the "modal3body" tags:

<div id="modal3" class="modal fade" role="dialog">
    <div class="modal-dialog modal-lg">
        <!-- Modal content-->
        <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><div id="x">&times;</div></button>
            <h4 class="modal-title">Acuvue</h4>
        <div class="modal-body" id="modal3body">

        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

All help would be appreciated, I just don't know where I'm making the mistake.

  • can you try it as $pnp.sp.web.getFolderByServerRelativeUrl(folderUrl).expand("Folders, Files").get().then().(r => { and check ? – Gautam Sheth Feb 5 at 14:59
  • I tried that and didn't get much results sadly. – SaintLouis Events Feb 5 at 15:17
  • can you also change the calling function to getFiles("/bdm/business-development/Style Library"); and try ? – Gautam Sheth Feb 5 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.