Entreprise Wiki Page Ribbon CustomAction
-
Freitag, 27. April 2012 16:29
Hello,
I try to add a Ribbon tab on a Entreprise Wiki Page but the tab only showed on the ListView (List Pages) :
any idea ?
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction Id="MyCustomRibbonTab" Location="CommandUI.Ribbon" RegistrationType="ContentType" RegistrationId="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39004C1F8B46085B4D22B1CDC3DE08CFFB9C" > <CommandUIExtension> <CommandUIDefinitions> <CommandUIDefinition Location="Ribbon.Tabs._children"> <Tab Id="Ribbon.PolicyManager" Title="Policy Manager" Description="This holds my custom commands!" Sequence="501"> <Scaling Id="Ribbon.PolicyManager.Scaling"> <MaxSize Id="Ribbon.PolicyManager.MaxSize" GroupId="Ribbon.PolicyManager.CustomGroupExample" Size="ThreeMedium"/> <MaxSize Id="Ribbon.PolicyManager.Permissions.MaxSize" GroupId="Ribbon.PolicyManager.Permissions" Size="ThreeMedium"/> <Scale Id="Ribbon.PolicyManager.Scaling.CustomTabScaling" GroupId="Ribbon.PolicyManager.CustomGroupExample" Size="ThreeMedium" /> <Scale Id="Ribbon.PolicyManager.Permissions.Scaling" GroupId="Ribbon.PolicyManager.Permissions" Size="ThreeMedium" /> </Scaling> <Groups Id="Ribbon.PolicyManager.Groups"> <Group Id="Ribbon.PolicyManager.CustomGroupExample" Description="This is a custom group!" Title="Policy" Sequence="52" Template="Ribbon.Templates.PolicyManager"> <Controls Id="Ribbon.PolicyManager.CustomGroupExample.Controls"> <Button Id="Ribbon.PolicyManager.CustomGroupExample.HelloWorld" Command="PolicyManager.CreateDocumentCommand" Sequence="15" Image16by16="/_layouts/images/NewContentPageHS.png" Description="Create Document" LabelText="Create Document" TemplateAlias="cust1"/> <Button Id="Ribbon.PolicyManager.CustomGroupExample.GoodbyeWorld" Command="PolicyManager.AssignDocumentsCommand" Sequence="17" Description="Assign Documents to Users" LabelText="Assign Documents to Users" TemplateAlias="cust2"/> <Button Id="Ribbon.PolicyManager.CustomGroupExample.LoveWorld" Command="PolicyManager.LoveWorldCommand" Sequence="19" Description="Says I love the World!" LabelText="I love you, World!" TemplateAlias="cust3"/> </Controls> </Group> <Group Id="Ribbon.PolicyManager.Permissions" Description="Permissions Group" Title="Permissions" Sequence="54" Template="Ribbon.Templates.Permissions.PolicyManager"> <Controls Id="Ribbon.PolicyManager.Permissions.Controls"> <Button Id="Ribbon.PolicyManager.Permissions.AssignDocuments" Command="PolicyManager.AssignDocumentsCommand" Sequence="24" Image16by16="/_layouts/images/permissions16.png" Description="Assign Documents to Users" LabelText="Assign Documents to Users" TemplateAlias="cust1"/> <Button Id="Ribbon.PolicyManager.Permissions.ManageUsers" Command="PolicyManager.ManageUsersCommand" Sequence="25" Image16by16="/_layouts/images/personresult.gif" Description="Create Document" LabelText="Manage Users" TemplateAlias="cust2"/> <Button Id="Ribbon.PolicyManager.Permissions.ManageCommand" Command="PolicyManager.ManageGroupsCommand" Sequence="26" Image16by16="/_layouts/images/colleagues_16.png" Description="Manage Groups" LabelText="Manage Groups" TemplateAlias="cust3"/> </Controls> </Group> </Groups> </Tab> </CommandUIDefinition> <CommandUIDefinition Location="Ribbon.Templates._children"> <GroupTemplate Id="Ribbon.Templates.PolicyManager"> <Layout Title="ThreeMedium" LayoutTitle="ThreeMedium"> <Section Alignment="Top" Type="ThreeRow"> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="cust1" /> </Row> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="cust2" /> </Row> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="cust3" /> </Row> </Section> </Layout> </GroupTemplate> </CommandUIDefinition> <CommandUIDefinition Location="Ribbon.Templates._children"> <GroupTemplate Id="Ribbon.Templates.Permissions.PolicyManager"> <Layout Title="ThreeMedium" LayoutTitle="ThreeMedium"> <Section Alignment="Top" Type="ThreeRow"> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="cust1" /> </Row> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="cust2" /> </Row> <Row> <ControlRef DisplayMode="Medium" TemplateAlias="cust3" /> </Row> </Section> </Layout> </GroupTemplate> </CommandUIDefinition> </CommandUIDefinitions> <CommandUIHandlers> <CommandUIHandler Command="PolicyManager.CreateDocumentCommand" CommandAction="javascript: function showCreateNewDocumentDialog() { var options = { url: '{SiteUrl}/_layouts/Schneider.PolicyManager.UI/CreateDocumentDialog.aspx?List={ListId}', title: 'Create a new Document', allowMaximize: false, showClose: true }; SP.UI.ModalDialog.showModalDialog(options); } showCreateNewDocumentDialog(); " /> <CommandUIHandler Command="PolicyManager.AssignDocumentsCommand" CommandAction="{SiteUrl}/_layouts/Schneider.PolicyManager.UI/users/assign.aspx" /> <CommandUIHandler Command="PolicyManager.LoveWorldCommand" CommandAction="javascript:alert('I love you, world!');" /> <CommandUIHandler Command="PolicyManager.ManageUsersCommand" CommandAction="{SiteUrl}/_layouts/Schneider.PolicyManager.UI/users/index.aspx" /> <CommandUIHandler Command="PolicyManager.ManageGroupsCommand" CommandAction="{SiteUrl}/_layouts/Schneider.PolicyManager.UI/groups/index.aspx" /> </CommandUIHandlers> </CommandUIExtension> </CustomAction> </Elements>Regards,
Patrice
MCP
Alle Antworten
-
Dienstag, 1. Mai 2012 06:18Moderator
Hi plemanach,
From the code you provide, it is custom actions for Enterprise Wiki page content type, which means that if you have a library contains Enterprise Wiki page content type, then the custom tabs will be shown in the page view, it is working well.
If it isn’t your objective, please clarify what you want to achieve, and for the custom actions, please pay attention to the action locations and IDs, you may get more information from the following links:
Default Custom Action Locations and IDs:
http://msdn.microsoft.com/en-us/library/bb802730.aspx
How to: Modify the User Interface Using Custom Actions:
http://msdn.microsoft.com/en-us/library/ms473643.aspxThanks,
QiaoQiao Wei
TechNet Community Support
-
Dienstag, 1. Mai 2012 09:07
Hi Qiao,
I can see the custom tab on list view : Forms/AllItems.aspx not on the page itself this is my issue.
List view :
Page :
Regards,
Patrice
MCPD SharePoint Developer 2010
-
Dienstag, 1. Mai 2012 18:00
I finaly get my custom tab working, I have added this code on a control inside my custom layout :
protected override void OnPreRender(EventArgs e) { SPRibbon ribbon = SPRibbon.GetCurrent(this.Page); if (ribbon != null) { if (ribbon.IsTabAvailable("Ribbon.PolicyManager") == false) { ribbon.Minimized = false; ribbon.CommandUIVisible = true; ribbon.MakeTabAvailable("Ribbon.PolicyManager"); ribbon.InitialTabId = "Ribbon.PolicyManager"; ribbon.Visible = true; ribbon.ServerRendered = true; } } base.OnPreRender(e); }
I have also to remove two attributes : RegistrationType and RegistrationId to get the code working.
<CustomAction Id="MyCustomRibbonTab" Location="CommandUI.Ribbon" RegegistrationType="ContentType" RegistrationId="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF39004C1F8B46085B4D22B1CDC3DE08CFFB9C" >
so is it a bug or a feature ?
MCPD SharePoint Developer 2010
- Als Antwort markiert plemanach Dienstag, 1. Mai 2012 18:10

