Using Node PNP JS How to check whether a folder exists in a Document Library

%3CLINGO-SUB%20id%3D%22lingo-sub-251456%22%20slang%3D%22en-US%22%3EUsing%20Node%20PNP%20JS%20How%20to%20check%20whether%20a%20folder%20exists%20in%20a%20Document%20Library%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-251456%22%20slang%3D%22en-US%22%3E%3CP%3EThere%20are%20lot%20of%20examples%20on%20the%20Internet%20about%20checking%20whether%20a%20folder%20exists%20using%20CSOM.%20I%20did%20a%20lot%20of%20searching%20but%20couldn't%20find%20a%20good%20article%20that%20talks%20about%20doing%20this%20using%20PNP%20JS.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20highly%20appreciate%20if%20anyone%20could%20give%20an%20Insight%20on%20how%20to%20approach%20this.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-890415%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Node%20PNP%20JS%20How%20to%20check%20whether%20a%20folder%20exists%20in%20a%20Document%20Library%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-890415%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F190854%22%20target%3D%22_blank%22%3E%40Ricky%20Raghavan%3C%2FA%3E%26nbsp%3B%20hope%20this%20will%20help%20you.%2C%20below%20code%20works%20for%20me.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Epublic%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Estatic%3C%2F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3B%3C%2FSPAN%3E%3CSPAN%3E%22%22%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%2B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%3CROWLIMIT%3E1%3C%2FROWLIMIT%3E%22%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%2B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%22%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ereturn%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EviewXml%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E
Highlighted
Occasional Visitor

There are lot of examples on the Internet about checking whether a folder exists using CSOM. I did a lot of searching but couldn't find a good article that talks about doing this using PNP JS. 

 

I would highly appreciate if anyone could give an Insight on how to approach this.

 

 

Thanks!

1 Reply
Highlighted

@Ricky Raghavan  hope this will help you., below code works for me.

 

 

public static getDocSetOrFolder(endPoint,listTitle,folerName):Promise<any>{
        let web = new Web(endPoint);
        const xml=this.returnCamlQueryToGetDocSetOrFolder(folerName);
        const q: CamlQuery = {
            ViewXml: xml,
        };

        return web.lists.getByTitle(listTitle).getItemsByCAMLQuery(q).then((docDetails)=>{
            console.log("Folder details",docDetails);
            return docDetails;
        });

    }

    public static returnCamlQueryToGetDocSetOrFolder(folerName){
        const viewXml =
        "<View>" +
        "<Query>" +
            "<Where>" +
                "<And>" +
                    "<Eq>" +
                        "<FieldRef Name=\"FSObjType\"/>" +
                        "<Value Type=\"Integer\">1</Value>" +
                    "</Eq>" +
                    "<Eq>" +
                        "<FieldRef Name=\"FileLeafRef\" />" +
                        "<Value Type=\"Text\">" + folerName + "</Value>" +
                    "</Eq>" +
                "</And>" +
            "</Where>" +
        "</Query>" +
        "<RowLimit>1</RowLimit>" +
        "</View>";
        return viewXml;
    }