Hi all,
I would like to add a button to a ribbon on the new message window. I would
like to add this button as the first button on the message ribbon.
Everything I have read says you can only add a button group to the ribbon.
Furthermore is there an example of adding a new group to a new message
window?
Any suggestions would be greatly appreciated.
Here is an example to add a button to the existing ribbon try this code:
Code:The idea is to handle the GetCustomUI callback. It fires only the first time an item type is opened in that Outlook session and passes you a string ribbonID argument, which is the type of item being opened. This is a C# example of handling that callback for new mail items: public string GetCustomUI(string ribbonID) { //RibbonID indicates type of Inspector that is about to be displayed, // valid RibbonID values are as follows: //Microsoft.Outlook.Mail.Read //Microsoft.Outlook.Mail.Compose //Microsoft.Outlook.MeetingRequest.Read //Microsoft.Outlook.MeetingRequest.Send //Microsoft.Outlook.Appointment //Microsoft.Outlook.Contact //Microsoft.Outlook.Journal //Microsoft.Outlook.Task //Microsoft.Outlook.DistributionList //Microsoft.Outlook.Report //Microsoft.Outlook.Resend //Microsoft.Outlook.Response.Read //Microsoft.Outlook.Response.Compose //Microsoft.Outlook.Response.CounterPropose //Microsoft.Outlook.RSS //Microsoft.Outlook.Post.Read //Microsoft.Outlook.Post.Compose //Microsoft.Outlook.Sharing.Read //Microsoft.Outlook.Sharing.Compose //In this sample only new mail Inspector is handled for a button. switch (ribbonID) { case "Microsoft.Outlook.Mail.Compose": // Return the RibbonX markup stored as a resource in the project return Resources.CustomRibbon; default: { return String.Empty; } } } I'm not sure what version of VS you're using or if you're using a shared addin or a VSTO addin, but you can download the Outlook 2007 templates I have on my Web site (for VS 2005 for both shared and VSTO addins). Those have simple XML for adding 2 groups to a custom tab in a new email message. Each group gets 3 buttons. The templates are in C# and VB.NET (and VB6). They're at http://www.slovaktech.com/outlook_2007_templates.htm. For reference you should also download the schemas for Office 2007, you need those for the correct names for the ribbon UI and to locate a group within an existing tab or in the Office button groups. As I mentioned, they're pretty basic (from my book). The XML itself looks like this (from the VSTO C# sample): onLoad = "Ribbon_OnLoad" > insertAfterMso="TabNewMailMessage" > visible="true"> onAction="CSToggle" getPressed="CSPressed" getImage="CS_GetImage" /> onAction="CSToggle" getPressed="CSPressed" getSupertip="CS_GetSuperTip" getImage="CS_GetImage" /> getSupertip="CS_GetSuperTip" onAction="CSToggle" getPressed="CSPressed" getImage="CS_GetImage" /> visible="true"> getSupertip="CS_GetSuperTip" onAction="CS_Action" getImage="CS_GetImage" /> onAction="CS_Action" getSupertip="CS_GetSuperTip" getImage="CS_GetImage" />
ExlGuru
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks