phpSPO icon indicating copy to clipboard operation
phpSPO copied to clipboard

Issue while moving Files

Open sayujraghav opened this issue 2 years ago • 1 comments

I have been trying to move a set of files for the root folder of path : "/sites/myfolder/Shared Documents/samplefolder/myfolder/2020/08/5000256-test1' .I am getting error like this as below Fatal error: Uncaught Exception: The expression "Web/getfilebyserverrelativeurl('/sites/myfolder/Shared Documents/samplefolder/myfolder/2020/08/5000256-test1')/moveto(newurl=''/sites/dm-btl/Shared" is not valid. $ctx->getWeb()->getFileByServerRelativeUrl($sourcePath)->moveTo("'{$targetPath}'",1); please guide me to resolve this issue. May be because of the space between 'Shared Document' is what I primarly suspect.

sayujraghav avatar Mar 30 '22 06:03 sayujraghav

Try: $ctx->getWeb()->getFileByServerRelativeUrl($sourcePath)->moveTo("{$targetPath}",1); (without sigle quotes) or simply: $ctx->getWeb()->getFileByServerRelativeUrl($sourcePath)->moveTo($targetPath,1);

rfalcesSamca avatar Sep 14 '22 14:09 rfalcesSamca