Question

Tell me how to add a button to the Ribbon panel, without using a separate project in Visual Studio, that is possible?

enter image description here

Était-ce utile?

La solution

Only VS, this simple example is helped me:

  1. Open the visual studio 2012 as run as administrator.
  2. Create an Empty SharePoint Project.
  3. enter image description here
  4. Select a Farm Solution.
  5. enter image description here
  6. Add New Item to the solution.
  7. enter image description here
  8. Add a Module. Name it as CustomRibbonActionModule.
  9. By default, it will have a sample.txt. Now delete that txt file, since we don’t require that.
  10. And modify the Elements.xml as below.
  11. <?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Description="Open template" Id="68275191-272b-4c59-a9ee-ee736f76f2e5" Location="CommandUI.Ribbon" Title="Open template"> <CommandUIExtension> <CommandUIDefinitions> <CommandUIDefinition Location="Ribbon.EditingTools.CPEditTab.Clipboard.Controls._children"> <Button Id="Open template" Alt="Open template" Sequence="100" Command="CustomRibbonButton_CopyHtml_Command" Image16by16="/_layouts/images/NoteBoard_16x16.png" Image32by32="/_layouts/images/NoteBoard_32x32.png" LabelText="Open template" TemplateAlias="o1" /> </CommandUIDefinition> </CommandUIDefinitions> <CommandUIHandlers> <CommandUIHandler Command="CustomRibbonButton_CopyHtml_Command" CommandAction="javascript:openDialog('/SitePages/Template.aspx');" /> </CommandUIHandlers> </CommandUIExtension> </CustomAction> <CustomAction ScriptSrc="scripts/script.js" Location="ScriptLink" Sequence="100"> </CustomAction> <Module Name="CustomRibbonActionModule"> </Module> </Elements>
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top