How to recover information of the user according to his click ?

Hello,

I have any questions about VSTO for Outlook 2007. I success to create a button in my CommandBar (Standard) but if I want this button in my Appointment for my Calendar, it doesn't exist. So my question is : is it possible to have my button when I create an appointment ?

And my second question will be : how it's possible to know what the user is clicking. For example, he click on an email : how to recover the subject, description of this email.

Thanks for your help

[488 byte] By [Npi] at [2008-2-16]
# 1

Hi Npi,

For the first question, you could make your command button visible / invisible when a new appointment is created. To do this, you can attach to the ItemLoad event for the Items collection in the Calender folder. From an Outlook add-in startup context you can write something like:

private void ThisAddIn_Startup(object sender, System.EventArgs e)

{

Globals.ThisAddIn.Application.Session.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar).Items.ItemAdd += new Microsoft.Office.Interop.Outlook.ItemsEvents_ItemAddEventHandler(Items_ItemAdd);

}

void Items_ItemAdd(object Item)

{

// Your code here

}

If you want your button to be displayed in the inspector associated with the appoitnment, you can create a Ribbon of RibbonType: Microsoft.Outlook.Appointment instead of a command bar button. No extra logic required as it will show for every new appointment.

For your second question I assume you only care about the current Explorer, as for the current Inspector is obvious which one is the current item (as inspectors are associated with only one item) . If you just want to check for what elements are currently selected when your user clicks on your command bar button, you can resort to the selection object (Globals.ThisAddIn.Application.ActiveExplorer().Selection) and associated event (Globals.ThisAddIn.Application.ActiveExplorer().SelectionChange) from an Outlook-addin context).

DanielMolina-MSFT at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Visual Studio Tools for Office Orcas...

Visual Studio Orcas

Site Classified