Important files that we need to have an Idea:
http://msdn.microsoft.com/en-us/library/ms460194.aspx CustomAction Element
http://msdn.microsoft.com/en-us/library/bb802730.aspx Default Custom Action Locations and IDs
http://msdn.microsoft.com/en-us/library/ee537543.aspx CommandUIDefinition: Default Server Ribbon Customization Locations
http://msdn.microsoft.com/en-us/library/ms465980.aspx Custom Action Definition Schema
http://msdn.microsoft.com/en-us/library/ff458373.aspx Command UI Definition // Button, Tab, checkBox code ...
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="NewUIRibbonControl"
RegistrationType="List"
RegistrationId="101"
Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.Documents.New.Controls._children">
<Button
Id="NewUIRibbonControl.ShowHelp"
Alt="Help"
Sequence="1981"
Command="ShowHelp"
Image32by32="/_layouts/images/helpicon.gif"
LabelText="Help"
TemplateAlias="o1"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="ShowHelp"
CommandAction="javascript:window.open('http://msdn.microsoft.com/en-us/library/ee539395%28office.14%29.aspx');" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction Id="Ribbon.Library.Actions.ReplacementButton"
Location="CommandUI.Ribbon"
RegistrationId="101"
RegistrationType="List"
Title="Replace a Ribbon Button">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.Library.Actions.ConnectToClient">
<Button Id="Ribbon.Library.Actions.ConnectToClient.ReplacementButton"
Command="ReplacementButtonCommand"
Image16by16="/_layouts/images/actionseditpage16.gif"
Image32by32="/_layouts/images/actionssettings.gif"
LabelText="Replaced Button"
TemplateAlias="o2" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="ReplacementButtonCommand"
CommandAction="javascript:alert('This button has been replaced.');" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
<CustomAction
Id="MyCustomRibbonTab"
Location="CommandUI.Ribbon.ListView"
RegistrationId="101"
RegistrationType="List">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.Tabs._children">
<Tab
Id="Ribbon.CustomTabExample"
Title="My Custom Tab"
Description="This holds my custom commands!"
Sequence="501">
<Scaling
Id="Ribbon.CustomTabExample.Scaling">
<MaxSize
Id="Ribbon.CustomTabExample.MaxSize"
GroupId="Ribbon.CustomTabExample.CustomGroupExample"
Size="OneLargeTwoMedium"/>
<Scale
Id="Ribbon.CustomTabExample.Scaling.CustomTabScaling"
GroupId="Ribbon.CustomTabExample.CustomGroupExample"
Size="OneLargeTwoMedium" />
</Scaling>
<Groups Id="Ribbon.CustomTabExample.Groups">
<Group
Id="Ribbon.CustomTabExample.CustomGroupExample"
Description="This is a custom group!"
Title="Custom Group"
Sequence="52"
Template="Ribbon.Templates.CustomTemplateExample">
<Controls Id="Ribbon.CustomTabExample.CustomGroupExample.Controls">
<Button
Id="Ribbon.CustomTabExample.CustomGroupExample.HelloWorld"
Command="CustomTabExample.HelloWorldCommand"
Sequence="15"
Description="Says hello to the World!"
LabelText="Hello, World!"
TemplateAlias="cust1"/>
<Button
Id="Ribbon.CustomTabExample.CustomGroupExample.GoodbyeWorld"
Command="CustomTabExample.GoodbyeWorldCommand"
Sequence="17"
Description="Says good-bye to the World!"
LabelText="Good-bye, World!"
TemplateAlias="cust2"/>
<Button
Id="Ribbon.CustomTabExample.CustomGroupExample.LoveWorld"
Command="CustomTabExample.LoveWorldCommand"
Sequence="19"
Description="Says I love the World!"
LabelText="I love you, World!"
TemplateAlias="cust3"/>
</Controls>
</Group>
</Groups>
</Tab>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Templates._children">
<GroupTemplate Id="Ribbon.Templates.CustomTemplateExample">
<Layout
Title="OneLargeTwoMedium"
LayoutTitle="OneLargeTwoMedium">
<Section Alignment="Top" Type="OneRow">
<Row>
<ControlRef DisplayMode="Large" TemplateAlias="cust1" />
</Row>
</Section>
<Section Alignment="Top" Type="TwoRow">
<Row>
<ControlRef DisplayMode="Medium" TemplateAlias="cust2" />
</Row>
<Row>
<ControlRef DisplayMode="Medium" TemplateAlias="cust3" />
</Row>
</Section>
</Layout>
</GroupTemplate>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="CustomTabExample.HelloWorldCommand"
CommandAction="javascript:alert('Hello, world!');" />
<CommandUIHandler
Command="CustomTabExample.GoodbyeWorldCommand"
CommandAction="javascript:alert('Good-bye, world!');" />
<CommandUIHandler
Command="CustomTabExample.LoveWorldCommand"
CommandAction="javascript:alert('I love you, world!');" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
No comments:
Post a Comment