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
| $ProgressPreference = "SilentlyContinue" | |
| $WarningPreference = "SilentlyContinue" | |
| #Import Modudle | |
| Import-Module $PSScriptRoot\SharePointPnPPowerShellOnline\SharePointPnPPowerShellOnline.psd1 -ErrorAction SilentlyContinue | |
| #Uncomment to run the same script to your local | |
| #$env:APPSETTING_PWord="<Passowrd>" | |
| #$env:APPSETTING_User="<userName>" |
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
| <AppPermissionRequests AllowAppOnlyPolicy="true"> | |
| <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" /> | |
| <AppPermissionRequest Scope="http://sharepoint/social/tenant" Right="Read" /> | |
| <AppPermissionRequest Scope="http://sharepoint/taxonomy " Right="Read" /> | |
| </AppPermissionRequests> |
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
| function Connect([string]$Url) { | |
| if ($Url -eq $Global:lastContextUrl) { | |
| return | |
| } | |
| if ($appId -ne $null -and $appSecret -ne $null) { | |
| Connect-PnPOnline -Url $Url -AppId $appId -AppSecret $appSecret | |
| } | |
| else { | |
| Connect-PnPOnline -Url $Url | |
| } |
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
| #Dev Import | |
| $Path = "C:\SharePointPnPPowerShell2013\" | |
| Import-Module '$Path\SharePointPnP.PowerShell.2013.Commands.dll'; | |
| #-----Function to create Site Columns----# | |
| function CreateSiteColumns($csvPath, $SiteURL) { | |
| $Cred = $global:GlobalCred | |
| $newUtfFile = "SiteCollectionSiteColumns_utf8.csv"; |
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
| ContentTypeName | ||
|---|---|---|
| MyContentType | ||
| MyContentType2 | ||
| MyContentType3 | ||
| MyContentType4 | ||
| MyContentType5 |
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 "") { |
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 { | |
| $URL='<Please enter your url>' | |
| Connect-PnPOnline -Url $URL -CurrentCredentials -ErrorAction Stop | |
| Write-host "Site $URL connected" | |
| #Working code | |
| Add-PnPJavaScriptBlock -Name "myAction" -script ' var ABC = alert("This is my Script block");' -Sequence 20000 -Scope Site | |
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
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
| URL,Action,Name,Title,Description,Group,LocationRibbon,Location,ButtonID,Alt,Sequence,Command,LabelText,TemplateAlias,Image32by32,Image16by16,CommandAction,EnabledScript,CAML1,CAML2,CAML3,CAML4,CAML5,CAML6,CAML7,CAML8,CAML9,CAML10,CAML11,CAML12,CAML13,CAML14 | |
| http://yahoo.com,Add,GetItemsCount,Invoke GetItemsCount Action,Adds custom action to custom list ribbon,SiteActions,CommandUI.Ribbon,Ribbon.List.Share.Controls._children,Ribbon.List.Share.GetItemsCountButton,Get list items count,11,Invoke_GetItemsCountButtonRequest,Get Items Count,o1,_layouts/15/images/placeholder32x32.png,_layouts/15/images/placeholder16x16.png,javascript: alert('Total items in this list: '+ ctx.TotalListItems);,javascript: function checkEnable() { return (true);} checkEnable();,"<CommandUIExtension><CommandUIDefinitions><CommandUIDefinition Location=""","""><Button Id=""",""" Alt=""",""" Sequence=""",""" Command=""",""" LabelText=""",""" TemplateAlias=""",""" Image32by32=""",""" Image16by16=""",""" /></CommandUIDefinition></CommandUIDef |
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 { | |
| Set-PnPTraceLog -On -LogFile 'C:\Users\basantp\Documents\PNP Blog Section\Code\traceoutput.txt' -Level Error -Delimiter "," | |
| $Url1 = "<URL>" | |
| Connect-PnPOnline -Url $Url1 -CurrentCredentials -ErrorAction Stop | |
| Write-host "Site $Url1 connected". | |
| $web =Get-PnPWeb | |
| Get-PnPProperty -ClientObject $web -Property Id | |
| "Only print the ID : $($web.Id)" |
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 { | |
| Set-PnPTraceLog -On -LogFile 'C:\Users\basantp\Documents\PNP Blog Section\Code\traceoutput.txt' -Level Error -Delimiter "," | |
| $Url1 = "<SiteURL>" | |
| $Url2 = "<SiteURL>" | |
| Connect-PnPOnline -Url $Url1 -CurrentCredentials -ErrorAction Stop | |
| Write-host "Site $Url1 connected". | |
| $Context1= Get-PnPContext |
NewerOlder