this is the code
when run this program showing this errors
Error 1 The type 'Microsoft.Office.Core.CommandBars' is defined in an assembly that is not referenced. You must add a reference to assembly 'Office, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. C:\Documents and Settings\kalaingar\Desktop\examples.net\Project1\projectkalai\projectkalai\Connect.cs 95 13 projectkalai
Error 2 Cannot implicitly convert type 'Microsoft.Office.Core.CommandBars []' to 'Microsoft.Office.Core.CommandBars [c:\Documents and Settings\kalaingar\Desktop\Interop.Microsoft.Office.Core.dll]' C:\Documents and Settings\kalaingar\Desktop\examples.net\Project1\projectkalai\projectkalai\Connect.cs 95 61 projectkalai
public class Connect : Object, Extensibility.IDTExtensibility2
{
private Microsoft.Office.Interop.Outlook.Application applicationobject;
private object addInInstance;
private CommandBarButton btnLaunch;
/// <summary>
/// Implements the constructor for the Add-in object.
/// Place your initialization code within this method.
/// </summary>
public Connect()
{
}
/// <summary>
/// Implements the OnConnection method of the IDTExtensibility2 interface.
/// Receives notification that the Add-in is being loaded.
/// </summary>
/// <param term='application'>
/// Root object of the host application.
/// </param>
/// <param term='connectMode'>
/// Describes how the Add-in is being loaded.
/// </param>
/// <param term='addInInst'>
/// Object representing this Add-in.
/// </param>
/// <seealso class='IDTExtensibility2' />
public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
{
}
/// <summary>
/// Implements the OnDisconnection method of the IDTExtensibility2 interface.
/// Receives notification that the Add-in is being unloaded.
/// </summary>
/// <param term='disconnectMode'>
/// Describes how the Add-in is being unloaded.
/// </param>
/// <param term='custom'>
/// Array of parameters that are host application specific.
/// </param>
/// <seealso class='IDTExtensibility2' />
public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
{
}
/// <summary>
/// Implements the OnAddInsUpdate method of the IDTExtensibility2 interface.
/// Receives notification that the collection of Add-ins has changed.
/// </summary>
/// <param term='custom'>
/// Array of parameters that are host application specific.
/// </param>
/// <seealso class='IDTExtensibility2' />
public void OnAddInsUpdate(ref System.Array custom)
{
}
/// <summary>
/// Implements the OnStartupComplete method of the IDTExtensibility2 interface.
/// Receives notification that the host application has completed loading.
/// </summary>
/// <param term='custom'>
/// Array of parameters that are host application specific.
/// </param>
/// <seealso class='IDTExtensibility2' />
public void OnStartupComplete(ref System.Array custom)
{
//CommandBars commandBar = (applicationobject.ActiveExplorer().CommandBars);
Microsoft.Office.Core.CommandBars commandbars = applicationobject.ActiveExplorer().CommandBars;
try
{
btnLaunch = (CommandBarButton)commandbars["Standard"].Controls["HelloWorld"];
}
catch
{
btnLaunch =(CommandBarButton)commandbars["Standard"].Controls.Add(1, System.Reflection.Missing.Value,System.Reflection.Missing.Value,System.Reflection.Missing.Value,System.Reflection.Missing.Value);
btnLaunch.Caption = "Hello World Browser!";
btnLaunch.Style = MsoButtonStyle.msoButtonCaption;
}
btnLaunch.Tag = "This is hello world Browser";
btnLaunch.OnAction = "!<EMailStatsAddIn.Connect>";
btnLaunch.Visible = true;
btnLaunch.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(btnLaunch_Click);
}
/// <summary>
/// Implements the OnBeginShutdown method of the IDTExtensibility2 interface.
/// Receives notification that the host application is being unloaded.
/// </summary>
/// <param term='custom'>
/// Array of parameters that are host application specific.
/// </param>
/// <seealso class='IDTExtensibility2' />
public void OnBeginShutdown(ref System.Array custom)
{
CommandBars commandBars = applicationobject.ActiveExplorer().CommandBars;
try
{
commandBars["Standard"].Controls["HelloWorld"].Delete(System.Reflection.Missing.Value);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void btnLaunch_Click(Microsoft.Office.Core.CommandBarButton Ctrl,
ref bool CancelDefault)
{
try
{
frmHelloWorld objfrmHelloWorld = new frmHelloWorld();
objfrmHelloWorld.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
//private object applicationObject;
//private object addInInstance;
}
try
{
commandBars["Standard"].Controls["HelloWorld"].Delete(System.Reflection.Missing.Value);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void btnLaunch_Click(Microsoft.Office.Core.CommandBarButton Ctrl,
ref bool CancelDefault)
{
try
{
frmHelloWorld objfrmHelloWorld = new frmHelloWorld();
objfrmHelloWorld.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
//private object applicationObject;
//private object addInInstance;
}
try
{
commandBars["Standard"].Controls["HelloWorld"].Delete(System.Reflection.Missing.Value);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void btnLaunch_Click(Microsoft.Office.Core.CommandBarButton Ctrl,
ref bool CancelDefault)
{
try
{
frmHelloWorld objfrmHelloWorld = new frmHelloWorld();
objfrmHelloWorld.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
//private object applicationObject;
//private object addInInstance;
}