0

I have a document library named FileUpload. Another folder named FileInfoes inside the FileUpload.

FileUpload(Document Library)

-----FileInfoes(Folder)

-----------Name

-----------Label(custom property)

How to retrieve Name & Label using PnP JS?

2

Sample demo to get files and mapped item.

<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pnp-pnpjs/1.3.5/pnpjs.es5.umd.bundle.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {            
            pnp.sp.web.getFolderByServerRelativeUrl("/sites/lee/MyDoc3/ParentFolder").files.get().then(files => {
                for (var i = 0; i < files.length; i++) {
                    var _ServerRelativeUrl = files[i].ServerRelativeUrl;
                    pnp.sp.web.getFileByServerRelativeUrl(_ServerRelativeUrl).getItem().then(item=> {
                        console.log(item);
                    });
                }
            });
        })        
    </script>

enter image description here

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.