M
Marcel Kulicke
Hello everyone!
I am really stuck in a problem. I wanna develop a small addin for Outlook
2003 Service Pack 1. I found a good article on that ("An introduction to
programming Outlook 2003 Using C#",
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/ol03csharp.asp)
and followed the instructions on that page.
Although my addin is registered and showed in the "COM-Add-Ins" Dialog in
Outlook, the CommandBarButton is not visible. I haven't found anything on
that topic through Google and this newsgroup.
Has anyone also experienced this problem?
Thanks in advance for every help!
CU,
Marcel
The code:
namespace OutlookDuplicateDeletion
{
using System;
using Microsoft.Office.Core;
using Extensibility;
using System.Runtime.InteropServices;
#region Read me for Add-in installation and setup information.
#endregion
[GuidAttribute("98B91FAC-A79C-447A-A2C0-444940635641"),
ProgId("OutlookDuplicateDeletion.Connect")]
public class Connect : Object, Extensibility.IDTExtensibility2
{
public Connect()
{
}
public void OnConnection(object application, Extensibility.ext_ConnectMode
connectMode, object addInInst, ref System.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(Extensibility.ext_DisconnectMode disconnectMode,
ref System.Array custom)
{
if(disconnectMode != ext_DisconnectMode.ext_dm_HostShutdown)
{
OnBeginShutdown(ref custom);
}
applicationObject = null;
}
public void OnAddInsUpdate(ref System.Array custom)
{
}
public void OnStartupComplete(ref System.Array custom)
{
CommandBars commandBars =
applicationObject.ActiveExplorer().CommandBars;
try
{
btnTerminateDuplicates = (CommandBarButton)
commandBars["Standard"].Controls["Duplicates"];
}
catch
{
btnTerminateDuplicates = (CommandBarButton)
commandBars["Standard"].Controls.Add(1,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value);
btnTerminateDuplicates.Caption = "Duplicates";
}
btnTerminateDuplicates.Tag = "Duplicates";
btnTerminateDuplicates.OnAction = "!<OutlookDuplicateDeletion.Connect>";
btnTerminateDuplicates.Visible = true;
btnTerminateDuplicates.Click += new
_CommandBarButtonEvents_ClickEventHandler(
btnTerminateDuplicates_Click);
}
public void OnBeginShutdown(ref System.Array custom)
{
btnTerminateDuplicates.Delete(System.Reflection.Missing.Value);
btnTerminateDuplicates = null;
}
private void btnTerminateDuplicates_Click(CommandBarButton Ctrl, ref bool
CancelDefault)
{
}
private CommandBarButton btnTerminateDuplicates;
private Microsoft.Office.Interop.Outlook.Application applicationObject;
private object addInInstance;
}
}
I am really stuck in a problem. I wanna develop a small addin for Outlook
2003 Service Pack 1. I found a good article on that ("An introduction to
programming Outlook 2003 Using C#",
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/ol03csharp.asp)
and followed the instructions on that page.
Although my addin is registered and showed in the "COM-Add-Ins" Dialog in
Outlook, the CommandBarButton is not visible. I haven't found anything on
that topic through Google and this newsgroup.
Has anyone also experienced this problem?
Thanks in advance for every help!
CU,
Marcel
The code:
namespace OutlookDuplicateDeletion
{
using System;
using Microsoft.Office.Core;
using Extensibility;
using System.Runtime.InteropServices;
#region Read me for Add-in installation and setup information.
#endregion
[GuidAttribute("98B91FAC-A79C-447A-A2C0-444940635641"),
ProgId("OutlookDuplicateDeletion.Connect")]
public class Connect : Object, Extensibility.IDTExtensibility2
{
public Connect()
{
}
public void OnConnection(object application, Extensibility.ext_ConnectMode
connectMode, object addInInst, ref System.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(Extensibility.ext_DisconnectMode disconnectMode,
ref System.Array custom)
{
if(disconnectMode != ext_DisconnectMode.ext_dm_HostShutdown)
{
OnBeginShutdown(ref custom);
}
applicationObject = null;
}
public void OnAddInsUpdate(ref System.Array custom)
{
}
public void OnStartupComplete(ref System.Array custom)
{
CommandBars commandBars =
applicationObject.ActiveExplorer().CommandBars;
try
{
btnTerminateDuplicates = (CommandBarButton)
commandBars["Standard"].Controls["Duplicates"];
}
catch
{
btnTerminateDuplicates = (CommandBarButton)
commandBars["Standard"].Controls.Add(1,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value,
System.Reflection.Missing.Value);
btnTerminateDuplicates.Caption = "Duplicates";
}
btnTerminateDuplicates.Tag = "Duplicates";
btnTerminateDuplicates.OnAction = "!<OutlookDuplicateDeletion.Connect>";
btnTerminateDuplicates.Visible = true;
btnTerminateDuplicates.Click += new
_CommandBarButtonEvents_ClickEventHandler(
btnTerminateDuplicates_Click);
}
public void OnBeginShutdown(ref System.Array custom)
{
btnTerminateDuplicates.Delete(System.Reflection.Missing.Value);
btnTerminateDuplicates = null;
}
private void btnTerminateDuplicates_Click(CommandBarButton Ctrl, ref bool
CancelDefault)
{
}
private CommandBarButton btnTerminateDuplicates;
private Microsoft.Office.Interop.Outlook.Application applicationObject;
private object addInInstance;
}
}