Skip to content

Instantly share code, notes, and snippets.

@BasantPandey
Last active July 18, 2017 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BasantPandey/e68b8d5cb784494123839b65bd6e3a91 to your computer and use it in GitHub Desktop.
Save BasantPandey/e68b8d5cb784494123839b65bd6e3a91 to your computer and use it in GitHub Desktop.
CSV file for Set multiple sites home page in single loop
Import-Module 'C:\Users\basantp\Documents\PNP Blog Section\Code\SharePointPnPPowerShell2013\SharePointPnP.PowerShell.2013.Commands.dll';
try {
$path = 'C:\Users\basantp\Documents\PNP Blog Section\Code\Branding'
$inputFile = $path + "\SetHomePage.csv"
$MyFile = Import-Csv $inputFile
foreach ($myRow in $MyFile) {
if ($myRow.SiteURL -ne "") {
Connect-PnPOnline -Url $MYROW.SiteURL -CurrentCredentials -ErrorAction Stop
Write-host "Site $MYROW.SiteURL connected"
Set-PnPHomePage -RootFolderRelativeUrl $MYROW.HomeURL
}
}
}
catch {
"error"
}
SiteURL HomeURL
http://yahoo.com SitePages/Home.aspx
http://yahoo.com SitePages/Home.aspx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment