Can You help to add custom button to Calendar. I have code for Document Library, but have no clue how to do same for Calendar. I see ribbon names in DevTools and tried to change groups and xml properties, but no luck.
Here is my code for Document Library view, how to do same for Calendar view?
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="483fe75b-c3d1-4ec7-965d-30e8fc024517.MyRibbonButton"
RegistrationType="List"
RegistrationId="{$ListId:Custom_Docs;}"
Location="CommandUI.Ribbon"
Sequence="10001"
Title="My Ribbon Button action">
<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Documents.Groups._children">
<Group Id="My Ribbon Button" Title="My Ribbon Button" Template="Ribbon.Templates.Flexible2" Command="My Ribbon Button.Command">
<Controls Id="My Ribbon Button.Controls">
<Button Id="Ribbon.Documents.Share.PublishToHomeButton"
Alt="My Button"
Sequence="100"
Command="Invoke_MyButtonEvent"
LabelText="My Button"
TemplateAlias="o1"
Image32by32="/_layouts/15/images/stsappcatalogribbon16x16.png?rev=23"
Image16by16="/_layouts/15/images/stsappcatalogribbon32x32.png?rev=23" />
</Controls>
</Group>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Documents.Scaling._children">
<MaxSize Id="My Ribbon Button.Scaling.MaxSize" GroupId="My Ribbon Button" Size="LargeLarge" />
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Templates._children">
<GroupTemplate Id="Ribbon.Templates.Flexible2">
<Layout Title="LargeLarge" LayoutTitle="LargeLarge">
<OverflowSection DisplayMode="Large" TemplateAlias="o1" Type="OneRow" />
<OverflowSection DisplayMode="Large" TemplateAlias="o2" Type="OneRow" />
</Layout>
<Layout Title="LargeMedium" LayoutTitle="LargeMedium">
<OverflowSection DisplayMode="Large" TemplateAlias="o1" Type="OneRow" />
<OverflowSection DisplayMode="Medium" TemplateAlias="o2" Type="ThreeRow" />
</Layout>
<Layout Title="LargeSmall" LayoutTitle="LargeSmall">
<OverflowSection DisplayMode="Large" TemplateAlias="o1" Type="OneRow" />
<OverflowSection DisplayMode="Small" TemplateAlias="o2" Type="ThreeRow" />
</Layout>
<Layout Title="MediumLarge" LayoutTitle="MediumLarge">
<OverflowSection DisplayMode="Medium" TemplateAlias="o1" Type="ThreeRow" />
<OverflowSection DisplayMode="Large" TemplateAlias="o2" Type="OneRow" />
</Layout>
<Layout Title="MediumMedium" LayoutTitle="MediumMedium">
<OverflowSection DisplayMode="Medium" TemplateAlias="o1" Type="ThreeRow" />
<OverflowSection DisplayMode="Medium" TemplateAlias="o2" Type="ThreeRow" />
</Layout>
<Layout Title="MediumSmall" LayoutTitle="MediumSmall">
<OverflowSection DisplayMode="Medium" TemplateAlias="o1" Type="ThreeRow" />
<OverflowSection DisplayMode="Small" TemplateAlias="o2" Type="ThreeRow" />
</Layout>
<Layout Title="SmallLarge" LayoutTitle="SmallLarge">
<OverflowSection DisplayMode="Small" TemplateAlias="o1" Type="ThreeRow" />
<OverflowSection DisplayMode="Large" TemplateAlias="o2" Type="OneRow" />
</Layout>
<Layout Title="SmallMedium" LayoutTitle="SmallMedium">
<OverflowSection DisplayMode="Small" TemplateAlias="o1" Type="ThreeRow" />
<OverflowSection DisplayMode="Medium" TemplateAlias="o2" Type="ThreeRow" />
</Layout>
<Layout Title="SmallSmall" LayoutTitle="SmallSmall">
<OverflowSection DisplayMode="Small" TemplateAlias="o1" Type="ThreeRow" />
<OverflowSection DisplayMode="Small" TemplateAlias="o2" Type="ThreeRow" />
</Layout>
</GroupTemplate>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="My Ribbon Button.Command" CommandAction="javascript:alert('Hi!');" />
<CommandUIHandler Command="Invoke_MyButtonEvent"
CommandAction="javascript:alert('Hi!');"
EnabledScript="javascript:SP.ListOperation.Selection.getSelectedItems().length == 1;"/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
It is attached to 'Custom_Docs' list:
I want to add my custom group to existing 'Events' tab in Calendar, but simple change does not help, I get error during activation
Maybe somewone have existing example for Calendar tabs?
-- Update: Thank You for answer!
I tried to change but get activation errors. I also have no Add > New Item > Office/SharePoint > "Ribbon Custom Action" in my VS menu..
<CommandUIDefinition Location="Ribbon.Calendar.Events.Groups._children"> <!--here-->
<Group Id="My Ribbon Button" Title="My Ribbon Button" Template="Ribbon.Templates.Flexible2" Command="My Ribbon Button.Command">
<Controls Id="My Ribbon Button.Controls">
<Button Id="Ribbon.Documents.Share.PublishToHomeButton"
Alt="My Button"
Sequence="100"
Command="Invoke_MyButtonEvent"
LabelText="My Button"
TemplateAlias="o1"
Image32by32="/_layouts/15/images/stsappcatalogribbon32x32.png?rev=23"
Image16by16="/_layouts/15/images/stsappcatalogribbon16x16.png?rev=23" />
</Controls>
</Group>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Calendar.Events.Actions.Controls._children"> <!--here-->
<MaxSize Id="My Ribbon Button.Scaling.MaxSize" GroupId="My Ribbon Button" Size="LargeLarge" />
</CommandUIDefinition>
-- Update 2: Ok, I found that "Adde Ribbon Custom Action" is available for 'SharePoint-Hosted App' projects. But it does not help much..