![]() |
| 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. |
|
|||||||
| Tags: addin, build, control, duplicate, every, outlook |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
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 | |
|
|
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 |