Facing issue while copying folder contains files from one library to another Library using pnp js

%3CLINGO-SUB%20id%3D%22lingo-sub-2164879%22%20slang%3D%22en-US%22%3ECopyTo%20function%20issue%20while%20copying%20folder%20contains%20files%20from%20one%20library%20to%20another%20Library%20using%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2164879%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20copy%20the%20folder%20from%20one%20library%20to%20another%20library.%20But%20i%20am%20getting%20an%20error%20as%20below.%3C%2FP%3E%3CP%3EpnpWebsite.getFolderByServerRelativePath(...).copyTo%20is%20not%20a%20function%20TypeError%3A%20pnpWebsite.getFolderByServerRelativePath(...).copyTo%20is%20not%20a%20function.%3C%2FP%3E%3CP%3EI%20tried%20like%20below%20var%20pnpWebsite%20%3D%20%24pnp.sp.web%3B%20pnpWebsite.getFolderByServerRelativePath(%22Path%22).copyTo(LibraryUrl).then(function(res)%20%7B%20%7D)%3B%3C%2FP%3E%3CP%3EAm%20i%20doing%20any%20wrong.%20Please%20correct%20me%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

 

I am trying to copy the folder from one library to another library. But i am getting an error as below.

 

pnpWebsite.getFolderByServerRelativePath(...).copyTo is not a function TypeError: pnpWebsite.getFolderByServerRelativePath(...).copyTo is not a function.

 

I tried like below

var pnpWebsite = $pnp.sp.web; pnpWebsite.getFolderByServerRelativePath("Path").copyTo(LibraryUrl).then(function(res) { });

 

Am i doing any wrong. Please correct me

0 Replies