Last active
July 18, 2017 17:37
-
-
Save BasantPandey/e68b8d5cb784494123839b65bd6e3a91 to your computer and use it in GitHub Desktop.
CSV file for Set multiple sites home page in single loop
This file contains hidden or 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
| 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" | |
| } |
This file contains hidden or 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 | 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