Last active
March 8, 2018 05:04
Revisions
-
rjesh-git revised this gist
Mar 8, 2018 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -35,4 +35,8 @@ Connect-PnPOnline -Url https://m365x642699.sharepoint.com/sites/NewYork03 $jsonObj = '{"title":"Site Contact","layout":2,"persons":[{"id":"i:0#.f|membership|alexw@m365x642699.onmicrosoft.com"}]}' $wp = $jsonObj | ConvertFrom-Json | ConvertTo-HashTable #Add People webpart with default user, to column 2 in section 1 Add-PnPClientSideWebPart -Page "Home" -DefaultWebPartType People -Section 1 -Column 2 -WebPartProperties $wp #Finally publish the page Set-PnPClientSidePage -Identity "Home" -Publish -
rjesh-git revised this gist
Mar 8, 2018 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -33,7 +33,6 @@ function ConvertTo-Hashtable { Connect-PnPOnline -Url https://m365x642699.sharepoint.com/sites/NewYork03 $jsonObj = '{"title":"Site Contact","layout":2,"persons":[{"id":"i:0#.f|membership|alexw@m365x642699.onmicrosoft.com"}]}' $wp = $jsonObj | ConvertFrom-Json | ConvertTo-HashTable Add-PnPClientSideWebPart -Page "Home" -DefaultWebPartType People -Section 1 -Column 2 -WebPartProperties $wp -
rjesh-git created this gist
Mar 8, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ function ConvertTo-Hashtable { [CmdletBinding()] [OutputType('hashtable')] param ( [Parameter(ValueFromPipeline)] $InputObject ) process { if ($null -eq $InputObject) { return $null } if ($InputObject -is [System.Collections.IEnumerable] -and $InputObject -isnot [string]) { $collection = @( foreach ($object in $InputObject) { ConvertTo-Hashtable -InputObject $object } ) Write-Output -NoEnumerate $collection } elseif ($InputObject -is [psobject]) { $hash = @{} foreach ($property in $InputObject.PSObject.Properties) { $hash[$property.Name] = ConvertTo-Hashtable -InputObject $property.Value } $hash } else { $InputObject } } } Connect-PnPOnline -Url https://m365x642699.sharepoint.com/sites/NewYork03 $jsonObj = '{"title":"Site Contact","layout":2,"persons":[{"id":"i:0#.f|membership|alexw@m365x642699.onmicrosoft.com"}]}' $wp = $jsonObj | ConvertFrom-Json | ConvertTo-HashTable Add-PnPClientSideWebPart -Page "Home" -DefaultWebPartType People -Section 1 -Column 2 -WebPartProperties $wp