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_SelectionChange);
_Explorer.ExplorerEvents_10_Event_Close -= new
Microsoft.Office.Interop.Outlook.ExplorerEvents_10_CloseEventHandler(_Explorer_ExplorerEvents_10_Event_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(OpenConfRoomScheduler);
}
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
}
}