daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Dec 18th, 2018 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <CommandUIHandler Command="Invoke_RibbonCustomAction1ButtonRequest"
  2.                   CommandAction="javascript:alert('123');"/>
  3.    
  4. <CustomAction ScriptSrc="~appWebUrl/Scripts/HelloWorld.js"
  5.               Location="ScriptLink" Sequence="1">
  6.  
  7. <CommandUIHandler Command="Invoke_RibbonCustomAction1ButtonRequest"
  8.                   CommandAction="javascript:tryMe();"/>
  9.    
  10. <CommandUIExtension>
  11. <CommandUIDefinitions>
  12.     <CommandUIDefinition Location="Ribbon.Library.ViewFormat.Controls._children">
  13.         <Button Id="Ribbon.Library.ViewFormat.About"
  14.             Command="AboutButtonCommand"
  15.             LabelText="About"
  16.             Image32by32="{SiteUrl}/_layouts/15/1033/Images/formatmap32x32.png?rev=23"
  17.             Image32by32Top="-273"
  18.             Image32by32Left="-1"
  19.             Description="About"
  20.             TemplateAlias="o1" />
  21.     </CommandUIDefinition>
  22. </CommandUIDefinitions>
  23. <CommandUIHandlers>
  24.     <CommandUIHandler
  25.         Command="AboutButtonCommand"
  26.         CommandAction="javascript:aboutScript({SelectedItemId});"
  27.         EnabledScript="javascript:onlyOneItemSelected();" />
  28. </CommandUIHandlers>
  29.    
  30. function aboutScript(itemId) {
  31.     alert("Hello user! You have selected item " + itemId);
  32. }
  33.  
  34. function onlyOneItemSelected() {
  35.     return (SP.ListOperation.Selection.getSelectedItems().length == 1)
  36. }
  37.    
  38. Add-PnPFile -Path .AboutButtonScript.js -Folder "Scripts"
  39.  
  40. $ribbon = Get-Content .MyRibbon.xml
  41. $ribbon = [string]$ribbon
  42. Add-PnPCustomAction -Name "RibbonTester" -Title "RibbonTester" -Description "-" -Group "Tester" -Location "CommandUI.Ribbon" -CommandUIExtension $ribbon -RegistrationType ContentType -RegistrationId 0x0101
  43.  
  44. Add-PnPJavaScriptLink -Name "AboutButtonScript" -Url https://mytenant.sharepoint.com/sites/perm-tester/Scripts/AboutButtonScript.js -Scope Web
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top