The Customization of ribbons and his behavior continues to be a big headache to developer and Site Administrators that need to make some customization in their Site.
This article provides some examples of Ribbon XML Structure you can use to customize your SharePoint Lists/Libraries.
This article provides some examples of Ribbon XML Structure you can use to customize your SharePoint Lists/Libraries.
Part II: Examples of Ribbons Customization in SharePoint 2013
Part III: Examples of Ribbons Customization in SharePoint 2013
Part IV: Examples of Ribbons Customization in SharePoint 2013
Part V: Examples of Ribbons Customization in SharePoint 2013
Part VI: Examples of Ribbons Customization in SharePoint / Office 365 - Send Email notification as reminder
Customizing Ribbons
Customization of a Ribbon can be included in SharePoint sites using Custom Actions associated in the UI Extension using XML format. This Structure can be included in Visual Studio using structure file "Element.xml" and deploy as solution (SP App, SP Sandbox or SP Farm) or using SharePoint Object UserCustomAction or using this Ribbon Manager Tool.
for more information about this Tool and new version please access the following link:
SharePoint App Processlynx Custom Action and Ribbon Manager Launcha Free version can be accessed here:
Free version of SharePoint App Custom Action & Ribbon Manager available in Office Store
You can read articles about add Custom Action with Ribbons in a declarative way or add in JSOM way.
The following Table are the main Location will be located the Custom Ribbons when the User Custom Action is created.
Locations
|
Description
|
CommandUI.Ribbon
|
Location corresponds to the
list view and edit, new, and display forms for the list
|
CommandUI.Ribbon.ListView
|
Location corresponds to the
list view.
|
CommandUI.Ribbon.EditForm
|
Location corresponds to the
edit form for the list.
|
CommandUI.Ribbon.NewForm
|
Location corresponds to the
new form for the list.
|
CommandUI.Ribbon.DisplayForm
|
Location corresponds to the
display form for the list.
|
The following
XML Ribbon examples :
- Add Custom Tab
- Add Custom Group to Custom Tab
- Add Custom Group Template with Checkbox Control
- Add Custom Control in Custom Group and Custom Tab
- Add Custom Group/Control (Large) in existing Tab
- Add Custom Group/Control (Large/Medium) in existing Tab
- Add FlyoutAnchor in Custom Tab/Custom Group
- Add Button Control in Existing Tab/Group
- Hide existing Ribbon control
- Replace existing Ribbon control
Tab
This option will help customizing Ribbons in lists/Libraries creating a custom Tab that responses specific Business rules and isolates from the existing SharePoint Out of the box Ribbons Controls.
Add Custom Tab
This example create a custom Tab but will not be shown because there isn't a Group associated.
Custom Tab Example:
This example create a custom Tab but will not be shown because there isn't a Group associated.
Custom Tab Example:
<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Tabs._children">
<Tab Id="My Custom Tab" Title="My Custom Tab" Description="My Custom Tab" Sequence="0">
<Scaling Id="My Custom Tab.Scaling">
</Scaling>
<Groups Id="My Custom Tab.Groups">
</Groups>
</Tab>
</CommandUIDefinition>
</CommandUIDefinitions>
</CommandUIExtension>
Group
This option defines the area and layout on how the controls will be displayed, this is a very important section because will have impact in the position and size of the Custom Controls in the Ribbon.
Add Custom Group to
Custom Tab
This option uses a custom Group Template call Flexible2 to be associated with the created Custom Tab.
This option uses a custom Group Template call Flexible2 to be associated with the created Custom Tab.
<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Tabs._children">
<Tab Id="My Custom Tab" Title="My Custom Tab" Description="My Custom Tab" Sequence="0">
<Scaling Id="My Custom Tab.Scaling">
<MaxSize Id="My Group.Scaling.MaxSize" GroupId="My Group" Size="LargeLarge" />
<Scale Id="My Group.Scaling.Scale" GroupId="My Group" Size="LargeLarge" />
</Scaling>
<Groups Id="My Custom Tab.Groups">
<Group Id="My Group" Title="My Group" Template="Ribbon.Templates.Flexible2" Command="My Group.Command">
<Controls Id="My Group.Controls">
</Controls>
</Group>
</Groups>
</Tab>
</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 Group.Command" CommandAction="javascript:return true;" />
</CommandUIHandlers>
</CommandUIExtension>
The final output of the Ribbon should be:
Group Template Options
Ok, when we are customizing Ribbons the creation of Group template is the most hard thing to be defined.
This will be the area where your controls will be organize and displayed in the Ribbon, this design area can have multiple format and ways to be displayed, it is recommended a good evaluation on how the ribbons will be displayed and then design.
Example of Custom Group Template Structure:
For all the examples except "Create Custom Group Template with Checkbox Control" was created a Custom Template call "Flexible2" this Template has multiple layouts that helps the customization of the Ribbons areas and how is displayed.
Here some examples of possible Custom Group template Layouts you can create or design:
or
Here a example of Custom Template Flexible2 XML with multiple layouts:
Example of Custom Group Template Structure:
This example came from processlynx SharePoint app (Ribbon)
For all the examples except "Create Custom Group Template with Checkbox Control" was created a Custom Template call "Flexible2" this Template has multiple layouts that helps the customization of the Ribbons areas and how is displayed.
Here some examples of possible Custom Group template Layouts you can create or design:
or

Here a example of Custom Template Flexible2 XML with multiple layouts:
<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>
Add Custom Group Template with Checkbox Control
This option uses a custom Group Template call Flexible2 to be associated with the created Custom Tab.
This option uses a custom Group Template call Flexible2 to be associated with the created Custom Tab.
<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Templates._children">
<GroupTemplate Id="Custom Group Template">
<Layout Title="Custom Group Template Layout" LayoutTitle="Custom Group Template Layout">
<Section Alignment="Top" Type="OneRow">
<Row>
<ControlRef DisplayMode="Small" TemplateAlias="Custom Group Template
Layout Alias 1" />
</Row>
</Section>
</Layout>
</GroupTemplate>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Library.Groups._children">
<Group Id="Custom Group with Custom Template" Title="Custom Group with
Custom Template" Template="Custom Group Template" Command="Custom Group with Custom Template.Command">
<Controls Id="Custom Group with Custom Template.Controls">
<CheckBox Id="Custom Group with Custom Template Button" LabelText="Custom Group with
Custom Template Button" Command="Custom Group with Custom Template Button.Command" TemplateAlias="Custom Group Template
Layout Alias 1" />
</Controls>
</Group>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Library.Scaling._children">
<MaxSize Id="Custom Group with Custom Template.Scaling.MaxSize" GroupId="Custom Group with
Custom Template" Size="Custom Group Template Layout" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="Custom Group with Custom Template.Command" CommandAction="javascript:return
true;" />
<CommandUIHandler Command="Custom Group with Custom Template Button.Command" CommandAction="javascript:(alert('Custom
Action');)" />
</CommandUIHandlers>
</CommandUIExtension>
The final output of the Ribbon should be:
The visual representation of our Ribbon should
be the following tree.
- Creation of the Custom Group Template and definition of his content
- After you create the Custom Template you can create multiple layouts to hum
- Each layout could have multiple designs and areas.
- Create a Custom Group using as Base the Custom Template created in "Custom Group Template", add control Checkbox using the Layout Small "Check box option can only be added with small or medium" and the Ribbon should be created.
This example came from processlynx SharePoint app (Ribbon)
Control Option
This option give the ability to create custom Controls associating actions as links or JavaScript that can be associated with a custom Layout.
Add Custom Control in Custom
Group and Custom Tab
This example add a Custom Large Control in a Custom Tab and Custom Group.
The XML structure defines the Tab > Group > Controls that should appear in the Ribbon.
<Tab Id="My Custom Tab" Title="My Custom Tab" Description="My Custom Tab" Sequence="0">
<Scaling Id="My Custom Tab.Scaling">
<MaxSize Id="My Group.Scaling.MaxSize" GroupId="My Group" Size="LargeLarge" />
<Scale Id="My Group.Scaling.Scale" GroupId="My Group" Size="LargeLarge" />
</Scaling>
<Groups Id="My Custom Tab.Groups">
<Group Id="My Group" Title="My Group" Template="Ribbon.Templates.Flexible2" Command="My Group.Command">
<Controls Id="My Group.Controls">
<Button Id="My Button" LabelText="My Button" Image16by16="/_layouts/15/1033/images/formatmap16x16.png?rev=33" Image16by16Left="-263" Image16by16Top="-2" Image32by32="/_layouts/15/1033/images/formatmap32x32.png?rev=33" Image32by32Left="-510" Image32by32Top="-0" Command="My Button.Command" TemplateAlias="o1" />
</Controls>
</Group>
</Groups>
</Tab>
Here is the full XML code example:
<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Tabs._children">
<Tab Id="My Custom Tab" Title="My Custom Tab" Description="My Custom Tab" Sequence="0">
<Scaling Id="My Custom Tab.Scaling">
<MaxSize Id="My Group.Scaling.MaxSize" GroupId="My Group" Size="LargeLarge" />
<Scale Id="My Group.Scaling.Scale" GroupId="My Group" Size="LargeLarge" />
</Scaling>
<Groups Id="My Custom Tab.Groups">
<Group Id="My Group" Title="My Group" Template="Ribbon.Templates.Flexible2" Command="My Group.Command">
<Controls Id="My Group.Controls">
<Button Id="My Button" LabelText="My Button" Image16by16="/_layouts/15/1033/images/formatmap16x16.png?rev=33" Image16by16Left="-263" Image16by16Top="-2" Image32by32="/_layouts/15/1033/images/formatmap32x32.png?rev=33" Image32by32Left="-510" Image32by32Top="-0" Command="My Button.Command" TemplateAlias="o1" />
</Controls>
</Group>
</Groups>
</Tab>
</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 Group.Command" CommandAction="javascript:return true;" />
<CommandUIHandler Command="My Button.Command" CommandAction="javascript:alert('My Action');" />
</CommandUIHandlers>
</CommandUIExtension>
The final output of the Ribbon should be:
Add Custom Group/Control (Large)
in existing Tab
This example add a Custom Large Control in a existing Tab but in a Custom Group.
<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Library.Groups._children">
<Group Id="My Custom Group in Existing Tab" Title="My Custom Group in
Existing Tab" Template="Ribbon.Templates.Flexible2" Command="My Custom Group in Existing Tab.Command">
<Controls Id="My Custom Group in Existing Tab.Controls">
<Button Id="My Custom Button" LabelText="My Custom Button" Image16by16="/_layouts/15/1033/images/formatmap16x16.png?rev=33" Image16by16Left="-163" Image16by16Top="-218" Image32by32="/_layouts/15/1033/images/formatmap32x32.png?rev=33" Image32by32Left="-270" Image32by32Top="-170" Command="My Custom
Button.Command" TemplateAlias="o1" />
</Controls>
</Group>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Library.Scaling._children">
<MaxSize Id="My Custom Group in Existing Tab.Scaling.MaxSize" GroupId="My Custom Group in
Existing Tab" 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 Custom Group in Existing Tab.Command" CommandAction="javascript:return
true;" />
<CommandUIHandler Command="My Custom Button.Command" CommandAction="javascript:alert('My custom Action')" />
</CommandUIHandlers>
</CommandUIExtension>
The final output of the Ribbon should be:
Add Custom Group/Control (Large/Medium) in existing Tab
This example add a Custom Large Control and medium control in a Row in a existing Tab but in a Custom Group.
Here is the full XML code example:
This example add a Custom Large Control and medium control in a Row in a existing Tab but in a Custom Group.
Here is the full XML code example:
<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Library.Groups._children">
<Group Id="My Custom Group in Existing Tab" Title="My Custom Group in Existing Tab" Template="Ribbon.Templates.Flexible2" Command="My Custom Group in Existing Tab.Command">
<Controls Id="My Custom Group in Existing Tab.Controls">
<Button Id="My Custom Button" LabelText="My Custom Button" Image16by16="/_layouts/15/1033/images/formatmap16x16.png?rev=33" Image16by16Left="-163" Image16by16Top="-218" Image32by32="/_layouts/15/1033/images/formatmap32x32.png?rev=33" Image32by32Left="-270" Image32by32Top="-170" Command="My Custom Button.Command" TemplateAlias="o1" />
<Button Id="My Custom Button 1" LabelText="My Custom Button 1" Image16by16="/_layouts/15/1033/images/formatmap16x16.png?rev=33" Image16by16Left="-303" Image16by16Top="-1" Image32by32="/_layouts/15/1033/images/formatmap32x32.png?rev=33" Image32by32Left="-372" Image32by32Top="-3" Command="My Custom Button 1.Command" TemplateAlias="o2" />
</Controls>
</Group>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Library.Scaling._children">
<MaxSize Id="My Custom Group in Existing Tab.Scaling.MaxSize" GroupId="My Custom Group in Existing Tab" Size="LargeMedium" />
</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 Custom Group in Existing Tab.Command" CommandAction="javascript:return true;" />
<CommandUIHandler Command="My Custom Button.Command" CommandAction="javascript:alert('My custom Action')" />
<CommandUIHandler Command="My Custom Button 1.Command" CommandAction="javascript:(alert('Teste'));" />
</CommandUIHandlers>
</CommandUIExtension>
The final output of the Ribbon should be:
Add FlyoutAnchor in
Custom Tab/Custom Group
This example add a Custom Large FlyoutAnchor Control in a Custom Tab and Custom Group.
This example add a Custom Large FlyoutAnchor Control in a Custom Tab and Custom Group.
<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Tabs._children">
<Tab Id="My Custom Tab" Title="My Custom Tab">
<Scaling Id="My Custom Tab.Scaling">
<MaxSize Id="My Custom Group.Scaling.MaxSize" GroupId="My Custom Group" Size="LargeMedium" />
<Scale Id="My Custom Group.Scaling.Scale" GroupId="My Custom Group" Size="LargeMedium" />
</Scaling>
<Groups Id="My Custom Tab.Groups">
<Group Id="My Custom Group" Title="My Custom Group" Template="Ribbon.Templates.Flexible2" Command="My Custom Group.Command">
<Controls Id="My Custom Group.Controls">
<FlyoutAnchor Id="My Custom
FlyoutAnchor" LabelText="My Custom FlyoutAnchor" Image16by16="/_layouts/15/1033/images/formatmap16x16.png?rev=33" Image16by16Left="-123" Image16by16Top="-3" Image32by32="/_layouts/15/1033/images/formatmap32x32.png?rev=33" Image32by32Left="-273" Image32by32Top="-173" Command="My Custom
FlyoutAnchor.Command" TemplateAlias="o1">
<Menu Id="My Custom
FlyoutAnchor.Menu">
<MenuSection Id="My Custom
FlyoutAnchor Menu" DisplayMode="Menu32">
<Controls Id="My Custom
FlyoutAnchor Menu.Controls">
<Button Id="My Custom
FlyoutAnchor Button" LabelText="My Custom FlyoutAnchor Button" Image16by16="/_layouts/15/1033/images/formatmap16x16.png?rev=33" Image16by16Left="-156" Image16by16Top="-3" Image32by32="/_layouts/15/1033/images/formatmap32x32.png?rev=33" Image32by32Left="-202" Image32by32Top="-137" Command="My Custom
FlyoutAnchor Button.Command" TemplateAlias="o1" />
</Controls>
</MenuSection>
</Menu>
</FlyoutAnchor>
</Controls>
</Group>
</Groups>
</Tab>
</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 Custom Group.Command" CommandAction="javascript:return true;" />
<CommandUIHandler Command="My Custom FlyoutAnchor.Command" CommandAction="" />
<CommandUIHandler Command="My Custom FlyoutAnchor Button.Command" CommandAction="javascript:alert('My
Custom Action');" />
</CommandUIHandlers>
With the ProcessLynx SharePoint App, you be able to see the Ribbon Structure of the FlyoutAnchor in the Custom Tab.
This example came from processlynx SharePoint app (Ribbon)
Add Button Control in Existing Tab/Group
<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Library.Actions.Controls._children">
<Button Id="My Button - existing location" LabelText="Existing location" Image16by16="/_layouts/15/1033/images/formatmap16x16.png?rev=33" Image16by16Left="-266" Image16by16Top="-1" Image32by32="/_layouts/15/1033/images/formatmap32x32.png?rev=33" Image32by32Left="-509" Image32by32Top="-0" Command="My Button - existing
location.Command" TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="My Button - existing location.Command" CommandAction="javascript:alert('My
Button in existing location');" />
</CommandUIHandlers>
</CommandUIExtension>
The final output of the Ribbon should be:
Override Control
This option can be used to re-write and change the behavior of existing Out of the box Ribbon Control.
Here are the Default Server Ribbon Customization Locations you can use to change the behavior.
http://msdn.microsoft.com/en-us/library/office/ee537543(v=office.14).aspx
Hide existing Ribbon control
The following example show how you can use XML UI Extension to hide existing controls like Open with Explorer "Ribbon.Library.Actions.OpenWithExplorer"
<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Library.Actions.OpenWithExplorer">
</CommandUIDefinition>
</CommandUIDefinitions>
</CommandUIExtension>
The final output of the Ribbon should be without the option:
Replace existing Ribbon control
This example, show how we can replace the existing "Open with Explorer" with custom a Custom Action and image associated.
This example, show how we can replace the existing "Open with Explorer" with custom a Custom Action and image associated.
Here the example of the XML code:
<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Library.Actions.OpenWithExplorer">
<Button Id="New Action" LabelText="New Action" Command="New Action.Command" TemplateAlias="o2" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="New Action.Command" CommandAction="javascript:alert('New Action');" />
</CommandUIHandlers>
</CommandUIExtension>
The final output of the Ribbon should be:
How to get Images position using SharePoint out of the Box image
When we are creating custom Buttons in the Ribbon it is possible to select a image position base in 16x16 or 32x32, only need to know the coordinates where is the icon as show in the XML and image bellow.
<Button Id="My Button - existing location" LabelText="Existing location" Image16by16="/_layouts/15/1033/images/formatmap16x16.png?rev=33" Image16by16Left="-266" Image16by16Top="-1" Image32by32="/_layouts/15/1033/images/formatmap32x32.png?rev=33" Image32by32Left="-509" Image32by32Top="-0" Command="My Button - existing location.Command" TemplateAlias="o1" />
Image position base in the image url:
Select the 16x16 position "shown in pink"
Image16by16Left="-266"
http://[Site]/_layouts/15/1033/images/formatmap16x16.png?rev=33
This example came from processlynx SharePoint app (Ribbon)
Select the 32x32 position "shown in pink"
Image32by32Left="-509"
http://[Site]/_layouts/15/1033/images/formatmap32x32.png?rev=33
This example came from processlynx SharePoint app (Ribbon)
PS: If
you are using SharePoint Online be careful, Microsoft is changing the position
of the icons.
All this examples where made in 10 minutes using a very user friendly "no knowledge of XML is needed" SharePoint App created by Processlynx, for more info you can send email to appsupport@processlynx.ch.
Custom Ribbon
Complex Ribbon
Support links:
SharePoint App Processlynx Custom Action and Ribbon Manager Launch
a Free version can be accessed here:
Free version of SharePoint App Custom Action & Ribbon Manager available in Office Store
Hope you like this article,
Support links:
SharePoint App Processlynx Custom Action and Ribbon Manager Launch
a Free version can be accessed here:
Free version of SharePoint App Custom Action & Ribbon Manager available in Office Store
Hope you like this article,
Kind regards,
Andre Lage
No comments:
Post a Comment