Build your professional network on facebook via our app Go to app
 
 
 
Industry : IT Services
Functional Area : Application Software
Activity: Question posted: 05 26 2009 17:33:58 +0000, 1 answers, 139 views, last activity 07 06 2010 20:18:08 +0000
 
Share
 
 
  Rate : 
 
 
  Answered by     prashant pamani, Project Leader -(Technical), Sunbelt Outsourcing Pvt Ltd  | 03 15 2010 14:35:42 +0000
[ Delete ]
[ Edit ]
Not Rated

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");          }      }  }  

 
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
Visual Merchandising is the art of displaying merchandise in a manner that is appealing to the...
 
211 referals 32 arguments, 712 views
Though media vs Self
 
157 referals 105 arguments, 3016 views
more...  
Unanswered Questions (22)