Thank you for reporting an issue, suggesting an enhancement, or asking a question. We appreciate your feedback - to help the team understand your
needs please complete the below template to ensure we have the details to help. Thanks!
Category
[ ] Enhancement
[] Bug
[X] Question
Version
Please specify what version of the library you are using: [2.0.7 ]
Expected / Desired Behavior / Question
I'd expect the publishing page to be copied. I was wondering if I am doing something wrong, is it possible to copy files between site collections in the same tenant?
Observed Behavior
When copying to target web, it throws File Not Found error.
Steps to Reproduce
Simply run the following code in the browser's dev console:
var targetWeb = new $pnp.Web("https://tenant.sharepoint.com/sites/target-web"), fileName = window.location.pathname.substr(window.location.pathname.lastIndexOf("/") + 1; // in my case I am trying to copy a publishing page $pnp.sp.web.getFileByServerRelativeUrl(window.location.pathname).getBlob().then(function (sourceFile){ targetWeb.getFolderByServerRelativeUrl("/sites/target-web/sub-site/Pages/").files.add(fileName, sourceFile, false).then(function (r) { console.log(r); }); });
Thanks!
Thank you for reporting an issue, suggesting an enhancement, or asking a question. We appreciate your feedback - to help the team understand your
needs please complete the below template to ensure we have the details to help. Thanks!
Category
[ ] Enhancement
[] Bug
[X] Question
Version
Please specify what version of the library you are using: [2.0.7 ]
Expected / Desired Behavior / Question
I'd expect the publishing page to be copied. I was wondering if I am doing something wrong, is it possible to copy files between site collections in the same tenant?
Observed Behavior
When copying to target web, it throws File Not Found error.
Steps to Reproduce
Simply run the following code in the browser's dev console:
var targetWeb = new $pnp.Web("https://tenant.sharepoint.com/sites/target-web"), fileName = window.location.pathname.substr(window.location.pathname.lastIndexOf("/") + 1; // in my case I am trying to copy a publishing page $pnp.sp.web.getFileByServerRelativeUrl(window.location.pathname).getBlob().then(function (sourceFile){ targetWeb.getFolderByServerRelativeUrl("/sites/target-web/sub-site/Pages/").files.add(fileName, sourceFile, false).then(function (r) { console.log(r); }); });Thanks!