Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <CommandUIHandler Command="Invoke_RibbonCustomAction1ButtonRequest"
- CommandAction="javascript:alert('123');"/>
- <CustomAction ScriptSrc="~appWebUrl/Scripts/HelloWorld.js"
- Location="ScriptLink" Sequence="1">
- <CommandUIHandler Command="Invoke_RibbonCustomAction1ButtonRequest"
- CommandAction="javascript:tryMe();"/>
- <CommandUIExtension>
- <CommandUIDefinitions>
- <CommandUIDefinition Location="Ribbon.Library.ViewFormat.Controls._children">
- <Button Id="Ribbon.Library.ViewFormat.About"
- Command="AboutButtonCommand"
- LabelText="About"
- Image32by32="{SiteUrl}/_layouts/15/1033/Images/formatmap32x32.png?rev=23"
- Image32by32Top="-273"
- Image32by32Left="-1"
- Description="About"
- TemplateAlias="o1" />
- </CommandUIDefinition>
- </CommandUIDefinitions>
- <CommandUIHandlers>
- <CommandUIHandler
- Command="AboutButtonCommand"
- CommandAction="javascript:aboutScript({SelectedItemId});"
- EnabledScript="javascript:onlyOneItemSelected();" />
- </CommandUIHandlers>
- function aboutScript(itemId) {
- alert("Hello user! You have selected item " + itemId);
- }
- function onlyOneItemSelected() {
- return (SP.ListOperation.Selection.getSelectedItems().length == 1)
- }
- Add-PnPFile -Path .AboutButtonScript.js -Folder "Scripts"
- $ribbon = Get-Content .MyRibbon.xml
- $ribbon = [string]$ribbon
- Add-PnPCustomAction -Name "RibbonTester" -Title "RibbonTester" -Description "-" -Group "Tester" -Location "CommandUI.Ribbon" -CommandUIExtension $ribbon -RegistrationType ContentType -RegistrationId 0x0101
- Add-PnPJavaScriptLink -Name "AboutButtonScript" -Url https://mytenant.sharepoint.com/sites/perm-tester/Scripts/AboutButtonScript.js -Scope Web
Add Comment
Please, Sign In to add comment