Last active
July 17, 2017 20:36
-
-
Save BasantPandey/eb6cf7ea28f9223899d2a57c5af6a336 to your computer and use it in GitHub Desktop.
Branding Add Custom Action CSV file
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
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></CommandUIDefinitions> | <CommandUIHandlers><CommandUIHandler Command=" | " CommandAction=" | " EnabledScript=" | "/></CommandUIHandlers></CommandUIExtension> | |
http://yahoo.com | Add | Ribbon.Library.Actions.AddAButton | Add a Ribbon Button | Adds custom action to custom list ribbon | SiteActions | CommandUI.Ribbon | Ribbon.Library.Share.Controls._children | Ribbon.Library.Share.NewRibbonButton | 10 | NewRibbonButtonCommand | Hello World | o2 | _layouts/15/images/placeholder32x32.png | _layouts/15/images/placeholder16x16.png | javascript:alert('Hello, world'); | <CommandUIExtension><CommandUIDefinitions><CommandUIDefinition Location=" | "><Button Id=" | " Alt=" | " Sequence=" | " Command=" | " LabelText=" | " TemplateAlias=" | " Image32by32=" | " Image16by16=" | " /></CommandUIDefinition></CommandUIDefinitions> | <CommandUIHandlers><CommandUIHandler Command=" | " CommandAction=" | "/></CommandUIHandlers></CommandUIExtension> |
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
Name | ||
---|---|---|
GetItemsCount | ||
Ribbon.Library.Actions.AddAButton |
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
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 + "\BrandingConfig_Add.csv" | |
#$inputFile =$path + "\BrandingConfig_Del.csv" uncomment this line for run del command | |
$MyFile = Import-Csv $inputFile | |
foreach ($myRow in $MyFile) | |
{ | |
Connect-PnPOnline -Url $MYROW.URL -CurrentCredentials -ErrorAction Stop | |
Write-host "Site $Url1 connected" | |
if($myRow.Action -eq "Add"){ | |
$CAML =$MYROW.CAML1 + $myRow.Location + | |
$MYROW.CAML2 + $myRow.ButtonID + | |
$MYROW.CAML3 + $myRow.Alt + | |
$MYROW.CAML4 + $myRow.Sequence + | |
$MYROW.CAML5 + $myRow.Command + | |
$MYROW.CAML6 + $myRow.LabelText + | |
$MYROW.CAML7 + $myRow.TemplateAlias + | |
$MYROW.CAML8 + $myRow.Image32by32 + | |
$MYROW.CAML9 + $myRow.Image16by16 + | |
$MYROW.CAML10 + | |
$MYROW.CAML11 + $myRow.CommandAction + | |
$MYROW.CAML12 | |
if($myRow.EnabledScript -eq ""){ | |
$CAML = $CAML+ $myRow.EnabledScript + $MYROW.CAML13 | |
} | |
$CAML = $CAML+ $myRow.ButtonID + $MYROW.CAML14; | |
$CAML | |
"Add Method Called" | |
Add-PnPCustomAction -Name $myRow.Name -Title $myRow.Title -Description $myRow.Description -Group $myRow.Group -Location $myRow.LocationRibbon -CommandUIExtension $CAML | |
} | |
if($myRow.Action -eq "Del"){ | |
$items = Get-PnPCustomAction | |
foreach ($i in $items){ | |
if( $i.Name -eq $myRow.Name){ | |
Remove-PnPCustomAction -Identity $i.Id -Force | |
} | |
} | |
} | |
} | |
} | |
catch{ | |
"error" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This Gist related to the blog post Office 365 & PNP PowerShell 2013 : Branding
. I posted some examples that help you to create a custom action via CSV file.