A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , , ,

Duplicate Outlook Add-in Control With Every Build





 
 
Thread Tools Display Modes
  #1  
Old April 12th 08, 01:41 AM posted to microsoft.public.outlook.program_addins
JRomeo
external usenet poster
 
Posts: 16
Default Duplicate Outlook Add-in Control With Every Build

The control I've created via VSTO add-in for Outlook 2003 works, but every
time I make a change and build it, I get an additional control on the
toolbar, a duplicate copy. It must be that I'm not cleaning up after myself
in the add-in. How can I prevent this from happening again and remove those
existing dups? Thanks!


--
Tip: Never eat yellow snow.
Ads
  #2  
Old April 12th 08, 02:12 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 1,592
Default Duplicate Outlook Add-in Control With Every Build

Do you create the button as temporary?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"JRomeo" wrote in message
...
The control I've created via VSTO add-in for Outlook 2003 works, but every
time I make a change and build it, I get an additional control on the
toolbar, a duplicate copy. It must be that I'm not cleaning up after
myself
in the add-in. How can I prevent this from happening again and remove
those
existing dups? Thanks!


--
Tip: Never eat yellow snow.



  #3  
Old April 14th 08, 06:51 PM posted to microsoft.public.outlook.program_addins
JRomeo
external usenet poster
 
Posts: 16
Default Duplicate Outlook Add-in Control With Every Build

I'm not sure. I'm new at this. Here's my .cs code:


using System;
using System.Windows.Forms;
using Microsoft.VisualStudio.Tools.Applications.Runtime;
using Outlook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;

namespace OutlookConfCallerBtn
{
public partial class ThisAddIn
{
Outlook.Inspectors openInspectors;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
//MessageBox.Show("");

openInspectors = this.Application.Inspectors;
openInspectors.NewInspector += new
Outlook.InspectorsEvents_NewInspectorEventHandler( newInspector_Event);

}

private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}

/// summary
/// Shuts the down add in.
/// /summary
/*private void ShutDownAddIn()
{
_ContactFolder = null;

_Explorer.SelectionChange -= new
Microsoft.Office.Interop.Outlook.ExplorerEvents_10 _SelectionChangeEventHandler(_Explorer_SelectionCh ange);
_Explorer.ExplorerEvents_10_Event_Close -= new
Microsoft.Office.Interop.Outlook.ExplorerEvents_10 _CloseEventHandler(_Explorer_ExplorerEvents_10_Eve nt_Close);
_Explorer = null;

openInspectors.NewInspector -= new
Microsoft.Office.Interop.Outlook.InspectorsEvents_ NewInspectorEventHandler(_Inspectors_NewInspector) ;
openInspectors = null;

Btn_ConfRoomSchdlr = null;


}*/

private void newInspector_Event(Outlook.Inspector new_Inspector)
{
// Check what type of inspector we have
Outlook.AppointmentItem item = new_Inspector.CurrentItem as
Outlook.AppointmentItem;

// For appointment items, add a custom control
if (item != null)
{
try
{
// Get the standard toolbar for this inspector
Office.CommandBars cmdBars = new_Inspector.CommandBars;
Office.CommandBar stdBar = cmdBars["standard"];

// Add the control
Office.CommandBarButton Btn_ConfRoomSchdlr =
(Office.CommandBarButton)stdBar.Controls.Add(1, missing, missing, missing,
missing);
Btn_ConfRoomSchdlr.Style =
Office.MsoButtonStyle.msoButtonCaption;
Btn_ConfRoomSchdlr.Caption = "Book A Room";
Btn_ConfRoomSchdlr.Tag = "Book A Room";

// Set the event
Btn_ConfRoomSchdlr.Click += new
Office._CommandBarButtonEvents_ClickEventHandler(O penConfRoomScheduler);
}

catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

}

private void OpenConfRoomScheduler(Office.CommandBarButton ctrl, ref
bool cancel)
{
// Assemble the Start Time and End Time values and open a URL
Outlook.AppointmentItem item =
this.Application.ActiveInspector().CurrentItem as Outlook.AppointmentItem;
String StartTime =
item.ItemProperties["Start"].Value.ToString();
String EndTime = item.ItemProperties["End"].Value.ToString();
String Subject =
item.ItemProperties["Subject"].Value.ToString();
String ConfSchdURL =
"http://wnetapps/confroom/index.cfm?event=wizard";
ConfSchdURL += "&StartTime=" + StartTime + "&EndTime=" + EndTime
+ "&Subject=" + Subject;
Object objWeb = CreateObject("InternetExplorer.Application");
objWeb.Navigate ConfSchdURL;
//item.GetInspector.ModifiedFormPages("Appointment") .
// Set objWeb = CreateObject("InternetExplorer.Application")
// objWeb.Navigate ConfSchdURL;

}

#region VSTO generated code

/// summary
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// /summary
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}

#endregion
}
}


--
Tip: Never eat yellow snow.


"Dmitry Streblechenko" wrote:

Do you create the button as temporary?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"JRomeo" wrote in message
...
The control I've created via VSTO add-in for Outlook 2003 works, but every
time I make a change and build it, I get an additional control on the
toolbar, a duplicate copy. It must be that I'm not cleaning up after
myself
in the add-in. How can I prevent this from happening again and remove
those
existing dups? Thanks!


--
Tip: Never eat yellow snow.




  #4  
Old April 14th 08, 10:09 PM posted to microsoft.public.outlook.program_addins
SvenC[_2_]
external usenet poster
 
Posts: 20
Default Duplicate Outlook Add-in Control With Every Build

HI JRomeo,

I'm not sure. I'm new at this. Here's my .cs code:
...
// Add the control
Office.CommandBarButton Btn_ConfRoomSchdlr =
(Office.CommandBarButton)stdBar.Controls.Add(1, missing, missing,
missing, missing);


The last param must be True, then you create a temporary button.

--
SvenC
  #5  
Old April 16th 08, 01:45 AM posted to microsoft.public.outlook.program_addins
JRomeo
external usenet poster
 
Posts: 16
Default Duplicate Outlook Add-in Control With Every Build

Yep, did the trick. Thx.


--
Tip: Never eat yellow snow.


"SvenC" wrote:

HI JRomeo,

I'm not sure. I'm new at this. Here's my .cs code:
...
// Add the control
Office.CommandBarButton Btn_ConfRoomSchdlr =
(Office.CommandBarButton)stdBar.Controls.Add(1, missing, missing,
missing, missing);


The last param must be True, then you create a temporary button.

--
SvenC

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question: How to build out of office reply to Outlook? Juha Outlook - General Queries 2 May 9th 07 01:55 PM
Latest Build of Outlook 2000? flexman77 Outlook - General Queries 6 January 16th 07 01:27 AM
Outlook View Control embedded in custom control tanutatu@hotmail.com Outlook - General Queries 1 November 8th 06 12:41 PM
Outlook View Control embedded in custom control tanutatu@hotmail.com Outlook - Using Forms 1 November 8th 06 12:41 PM
will outlook build contact info with inbox? A Alexander Outlook - Using Contacts 3 February 22nd 06 10:19 PM


All times are GMT +1. The time now is 09:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Best Credit Cards - Loans - MPAA - Mortgage insurance - Loans