<CustomAction Id="Ribbon.WebPartPage.CustomGroup" Location="CommandUI.Ribbon"> <CommandUIExtension> <CommandUIDefinitions> <CommandUIDefinition Location="Ribbon.WebPartPage.Groups._children"> <Group Id="Ribbon.WebPartPage.CustomGroup" Sequence="55" Description="des" Title="custom group" Command="CustomGroup" Template="Ribbon.Templates.Flexible2"> <Controls Id="Ribbon.WebPartPage.CustomGroup.Controls"> <Button Id="Ribbon.WebPartPage.CustomGroup.CustomGroupTemplate" Command="CustomGroupSelectTemplate" Image16by16="/_layouts/images/visualupgradehh.png" Image32by32="/_layouts/images/visualupgradehh.png" LabelText="选择模版" TemplateAlias="o2" Sequence="15" /> <Button Id="Ribbon.WebPartPage.CustomGroup.CustomGroupSkin" Command="CustomGroupSelectSkin" Image16by16="/_layouts/images/visualupgradehh.png" Image32by32="/_layouts/images/visualupgradehh.png" LabelText="选择皮肤" TemplateAlias="o2" Sequence="18" /> <Button Id="Ribbon.WebPartPage.CustomGroup.CustomGroupCMS" Command="CustomGroupCMS" Image16by16="/_layouts/images/visualupgradehh.png" Image32by32="/_layouts/images/visualupgradehh.png" LabelText="内容管理" TemplateAlias="o2" Sequence="21" /> </Controls> </Group> </CommandUIDefinition> <CommandUIDefinition Location="Ribbon.WebPartPage.Scaling._children"> <MaxSize Id="Ribbon.WebPartPage.Scaling.CustomGroup.MaxSize" Sequence="15" GroupId="Ribbon.WebPartPage.CustomGroup" Size="LargeLarge" /> </CommandUIDefinition> </CommandUIDefinitions> <CommandUIHandlers> <CommandUIHandler Command="CustomGroup" CommandAction="javascript:return true;" /> <CommandUIHandler Command="CustomGroupSelectTemplate" CommandAction="javascript:alert('Hello, world!');" /> <CommandUIHandler Command="CustomGroupSelectSkin" CommandAction="javascript:alert('Good-bye, world!');" /> <CommandUIHandler Command="CustomGroupCMS" CommandAction="javascript:alert('cms, world!');" /> </CommandUIHandlers> </CommandUIExtension> </CustomAction>
1、此按钮添加到“页面” tab页;
2、需要编辑页面才能看到效果;
3、javascript执行不来,不知道怎么回事;
最后改用urlaction
<CustomAction Id="SelectTemplate" GroupId="SiteActions" Location="Microsoft.SharePoint.StandardMenu" Sequence="1000" Title="自定义" Description=描述" ImageUrl="/_layouts/images/visualupgradehh.png" Rights="ManagePermissions"> <UrlAction Url="~site/_layouts/settings.aspx"/> </CustomAction>