Microsoft Office Tutorials and References
In Depth Information
Creating a Ribbon menu for Outlook 2007
6. To create a program that will open a window for composing a new mail on
a button click event, write the following code snippet inside the Ribbon1.cs
file. Also include the code using Microsoft.Office.Interop.Outlook; in
the Ribbon1.cs file to get access to the Outlook objects.
// Click event of the button
private void Button_OpenNewMail_Click(object sender,
RibbonControlEventArgs e)
// Application class to get Outlook object references
ApplicationClass PacktApplication = new ApplicationClass();
// Get the MAPIFolder NameSpaces
NameSpace PacktNameSpace = PacktApplication.
// Access to the default folders
MAPIFolder ApreeMAPI = PacktNameSpace.
// Outlook mailitem object to compose new mail
MailItem PacktMailItem = (MailItem)ApreeMAPI.Items.
// To display the new mail compose window
Search JabSto ::

Custom Search