{"id":6199,"date":"2020-07-24T14:59:47","date_gmt":"2020-07-24T14:59:47","guid":{"rendered":"https:\/\/www.softreetechnology.com\/?p=6199"},"modified":"2020-07-24T14:59:47","modified_gmt":"2020-07-24T14:59:47","slug":"copy-sites-page-from-one-site-to-another-using-pnp-powershell","status":"publish","type":"post","link":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/","title":{"rendered":"Copy Sites Page From One Site to Another Using PNP PowerShell"},"content":{"rendered":"\n<p>In this blog, we are going to discuss how\nto copy a modern page from one site collection to another site collection using\nPNP PowerShell.<\/p>\n\n\n\n<p>To successfully copy a modern page, you\nhave to follow the below steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>PowerShell\ncode<\/li><li>Run\nthe script<\/li><\/ul>\n\n\n\n<ol class=\"wp-block-list\"><li><span style=\"text-decoration: underline;\"><strong>PowerShell code<\/strong><\/span><\/li><\/ol>\n\n\n\n<p><strong>Instruction:<\/strong> In this code, first we have to set the\ncredential of the SharePoint. Then we export the Modern page and the page\ntemplate from the source site and apply it to the destination site. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try{\n$srcUrl = Read-Host \"Enter the source site url\"\n$destUrl = Read-Host \"Enter the destination site url\"\n$pageName = Read-Host \"Enter the page name which you want to copy\"\n$cred = Get-Credential\n\nConnect-PnPOnline -Url $srcUrl -Credentials $cred\n$tempFile = [System.IO.Path]::GetTempFileName();\nExport-PnPClientSidePage -Force -Identity $pageName -Out $tempFile\n\nConnect-PnPOnline -Url $destUrl -Credentials $cred\nApply-PnPProvisioningTemplate -Path $tempFile\nWrite-Host \"ModernPage is successfully copied.\"\nsleep 10\n}\ncatch{\nWrite-Host -ForegroundColor Red 'Error ',':'$Error[0].ToString();\nsleep 10\n} <\/code><\/pre>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">2. Run the script<\/span><\/strong><\/p>\n\n\n\n<p>&nbsp;To get the proper result follow the below\ninstructions: <\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Run the script.<\/li><li>Give the source site url from which you\nwant to copy.<\/li><li>Give the destination site url in which you\nwant to copy the modern page.<\/li><li>Type the page title which you want to\ncopy.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/07\/1-5.png\" alt=\"\" class=\"wp-image-6200\" width=\"552\" height=\"63\"\/><\/figure>\n\n\n\n<p>5. Then it shows a popup asking for credentials. Enter your username and password then click on ok.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/07\/2-4.png\" alt=\"\" class=\"wp-image-6201\" width=\"388\" height=\"302\"\/><\/figure>\n\n\n\n<p>6. Now your modern page is copied to your destination site.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/07\/3-4-1024x362.png\" alt=\"\" class=\"wp-image-6202\" width=\"643\" height=\"227\"\/><figcaption><br><br><\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/07\/4-2.png\" alt=\"\" class=\"wp-image-6203\" width=\"295\" height=\"232\"\/><\/figure>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\"><em>Keywords:<\/em><\/span><\/strong><br> \u2022 Copy Modern page from one site to another using PNP PowerShell.<br> \u2022 Programmatically copy a modern site page using PNP PowerShell.<br> \u2022 Clone modern page from one site to another site using PowerShell.<br> \u2022 Copy Sites Page from one site to another using PNP PowerShell.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, we are going to discuss how to copy a modern page from one site collection to another site collection using PNP PowerShell. To successfully copy a modern page, you have to follow the below steps: PowerShell code Run the script PowerShell code Instruction: In this code, first we have to set the credential of the SharePoint. Then [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[298],"tags":[],"class_list":["post-6199","post","type-post","status-publish","format-standard","hentry","category-pnp-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Copy Sites Page From One Site to Another Using PNP PowerShell - Softree Technology<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Copy Sites Page From One Site to Another Using PNP PowerShell - Softree Technology\" \/>\n<meta property=\"og:description\" content=\"In this blog, we are going to discuss how to copy a modern page from one site collection to another site collection using PNP PowerShell. To successfully copy a modern page, you have to follow the below steps: PowerShell code Run the script PowerShell code Instruction: In this code, first we have to set the credential of the SharePoint. Then [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"Softree Technology\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-24T14:59:47+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Copy Sites Page From One Site to Another Using PNP PowerShell - Softree Technology","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Copy Sites Page From One Site to Another Using PNP PowerShell - Softree Technology","og_description":"In this blog, we are going to discuss how to copy a modern page from one site collection to another site collection using PNP PowerShell. To successfully copy a modern page, you have to follow the below steps: PowerShell code Run the script PowerShell code Instruction: In this code, first we have to set the credential of the SharePoint. Then [&hellip;]","og_url":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/","og_site_name":"Softree Technology","article_published_time":"2020-07-24T14:59:47+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/#article","isPartOf":{"@id":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/"},"author":{"name":"admin","@id":"https:\/\/softreetechnology.com\/blog\/#\/schema\/person\/98740297642f06debccdcee2de84086b"},"headline":"Copy Sites Page From One Site to Another Using PNP PowerShell","datePublished":"2020-07-24T14:59:47+00:00","mainEntityOfPage":{"@id":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/"},"wordCount":211,"commentCount":0,"publisher":{"@id":"https:\/\/softreetechnology.com\/blog\/#organization"},"image":{"@id":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/07\/1-5.png","articleSection":["PnP PowerShell"],"inLanguage":"en","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/","url":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/","name":"Copy Sites Page From One Site to Another Using PNP PowerShell - Softree Technology","isPartOf":{"@id":"https:\/\/softreetechnology.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/#primaryimage"},"image":{"@id":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/07\/1-5.png","datePublished":"2020-07-24T14:59:47+00:00","breadcrumb":{"@id":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/#primaryimage","url":"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/07\/1-5.png","contentUrl":"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/07\/1-5.png"},{"@type":"BreadcrumbList","@id":"https:\/\/softreetechnology.com\/blog\/pnp-powershell\/copy-sites-page-from-one-site-to-another-using-pnp-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/softreetechnology.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Copy Sites Page From One Site to Another Using PNP PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/softreetechnology.com\/blog\/#website","url":"https:\/\/softreetechnology.com\/blog\/","name":"Softree Technology","description":"Celebrating 10+ Years in SharePoint Consulting !","publisher":{"@id":"https:\/\/softreetechnology.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/softreetechnology.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/softreetechnology.com\/blog\/#organization","name":"Softree Technology","url":"https:\/\/softreetechnology.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/softreetechnology.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/softreetechnology.com\/blog\/wp-content\/uploads\/2023\/03\/cropped-white-logo-soft.png","contentUrl":"https:\/\/softreetechnology.com\/blog\/wp-content\/uploads\/2023\/03\/cropped-white-logo-soft.png","width":844,"height":230,"caption":"Softree Technology"},"image":{"@id":"https:\/\/softreetechnology.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/softreetechnology.com\/blog\/#\/schema\/person\/98740297642f06debccdcee2de84086b","name":"admin","image":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/softreetechnology.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6fc78c8a7aa3fb0bf43c3b9a2e3962d7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6fc78c8a7aa3fb0bf43c3b9a2e3962d7?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/softreeconsulting.com"],"url":"https:\/\/softreetechnology.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/posts\/6199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/comments?post=6199"}],"version-history":[{"count":0,"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/posts\/6199\/revisions"}],"wp:attachment":[{"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/media?parent=6199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/categories?post=6199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/tags?post=6199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}