Last active
June 25, 2020 05:26
-
-
Save Vintaurus/3935e22411de33cbb1fffb18df85d55f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$siteUrl = "https://vinrotlab.io/" | |
$provisioningTemplateFileName = "startpage.xml" | |
$pageFileName = "welcome.aspx" | |
$librarySitePages = "SitePages" | |
$exportPath = "C:\export" | |
$provisioningTemplateFilePath = $exportPath + "/" + $provisioningTemplateFileName | |
function Get-Page($fileName) { | |
$pageFile = "/" + $librarySitePages + "/" + $fileName | |
# Temp file | |
$filePath = $exportPath + "\" + $fileName | |
# Export files to the folder | |
$sitePageFolder = $exportPath + "\" + $librarySitePages | |
If(!(test-path $exportPath)){ | |
New-Item -ItemType Directory -Force -Path $exportPath | |
} | |
If(!(test-path $sitePageFolder)){ | |
New-Item -ItemType Directory -Force -Path $sitePageFolder | |
} | |
#Save file to locale | |
Get-PnPFile -Url $pageFile -AsFile -Path $exportPath -Force | |
#Copy ..avoid the message '...because it is being used by another process' | |
Copy-Item $filePath -Destination $sitePageFolder | |
$copyFile = $sitePageFolder + "\" + $fileName | |
#Add file data to provisioning template | |
Add-PnPFileToProvisioningTemplate -Path $provisioningTemplateFilePath -Source $copyFile -Folder $librarySitePages | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment