|
|
Activity:
Question posted: 05 26 2009 17:33:58 +0000,
1 answers, 139 views, last activity
07 06 2010 20:18:08 +0000
|
|
|
|
Prev1NextShowing 1 - 1 of 1
Answered by
prashant pamani, Project Leader -(Technical), Sunbelt Outsourcing Pvt Ltd
| 03 15 2010 14:35:42 +0000
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using Extensibility; using Microsoft.Office.Core; using Microsoft.Office.Interop.Outlook; namespace OutlookAddinSample { public class Connect : Object, IDTExtensibility2 { private Application applicationObject; private object addInInstance; private CommandBarButton toolbarButton; Explorer currentExplorer = null; public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { applicationObject = (Microsoft.Office.Interop.Outlook.Application)application; addInInstance = addInInst; if (connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup) { OnStartupComplete(ref custom); } } public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom) { if (disconnectMode != Extensibility.ext_DisconnectMode.ext_dm_HostShutdown) { OnBeginShutdown(ref custom); } applicationObject = null; } public void OnAddInsUpdate(ref Array custom) { } public void OnStartupComplete(ref Array custom) { CommandBars commandBars = applicationObject.ActiveExplorer().CommandBars; try { this.toolbarButton = (CommandBarButton) commandBars["Standard"].Controls["Hello"]; } catch (System.Exception) { this.toolbarButton = (CommandBarButton)commandBars["Standard"].Controls.Add(1, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value); this.toolbarButton.Caption = "Hello"; this.toolbarButton.Style = MsoButtonStyle.msoButtonCaption; } this.toolbarButton.Tag = "Hello Button"; this.toolbarButton.OnAction = "!<MyAddin1.Connect>"; this.toolbarButton.Visible = true; this.toolbarButton.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler( this.OnToolbarButtonClick); } public void OnBeginShutdown(ref Array custom) { this.toolbarButton.Delete(System.Reflection.Missing.Value); this.toolbarButton = null; } private void OnToolbarButtonClick(CommandBarButton cmdBarbutton, ref bool cancel) { MessageBox.Show("Hello World", "My Addin"); } } }
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using Extensibility; using Microsoft.Office.Core; using Microsoft.Office.Interop.Outlook; namespace OutlookAddinSample { public class Connect : Object, IDTExtensibility2 { private Application applicationObject; private object addInInstance; private CommandBarButton toolbarButton; Explorer currentExplorer = null; public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { applicationObject = (Microsoft.Office.Interop.Outlook.Application)application; addInInstance = addInInst; if (connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup) { OnStartupComplete(ref custom); } } public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom) { if (disconnectMode != Extensibility.ext_DisconnectMode.ext_dm_HostShutdown) { OnBeginShutdown(ref custom); } applicationObject = null; } public void OnAddInsUpdate(ref Array custom) { } public void OnStartupComplete(ref Array custom) { CommandBars commandBars = applicationObject.ActiveExplorer().CommandBars; try { this.toolbarButton = (CommandBarButton) commandBars["Standard"].Controls["Hello"]; } catch (System.Exception) { this.toolbarButton = (CommandBarButton)commandBars["Standard"].Controls.Add(1, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value); this.toolbarButton.Caption = "Hello"; this.toolbarButton.Style = MsoButtonStyle.msoButtonCaption; } this.toolbarButton.Tag = "Hello Button"; this.toolbarButton.OnAction = "!<MyAddin1.Connect>"; this.toolbarButton.Visible = true; this.toolbarButton.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler( this.OnToolbarButtonClick); } public void OnBeginShutdown(ref Array custom) { this.toolbarButton.Delete(System.Reflection.Missing.Value); this.toolbarButton = null; } private void OnToolbarButtonClick(CommandBarButton cmdBarbutton, ref bool cancel) { MessageBox.Show("Hello World", "My Addin"); } } } Prev1NextShowing 1 - 1 of 1

Leading recruitment Firm
ASP.Net, VB.NET, SQL Server, Software Developer, Dhruv
Job Openings for Linux,File Server Developers.
Job Openings for Websphere Commerce, Bangalore
Viewers also viewed
|
|
|
|
|
|
Unanswered Questions (22)
|
|
|
|
|
|
Sponsored Jobs