I am developing outlook add-in for which I have to track appointment item add, change & remove events. So I am using bellow code.
public Microsoft.Office.Interop.Outlook.Application app = null;
public Outlook.NameSpace ns = null;
public Outlook.MAPIFolder calendar = null;
public Outlook.Items appointments = null;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
app = Application;
ns = app.GetNamespace("mapi");
ns.Logon("", "", true, true);
calendar = ns.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
appointments = calendar.Items;
appointments.ItemAdd += Item_Add;
appointments.ItemChange += Item_Change;
appointments.ItemRemove += Item_Remove;
}
private void Item_Add(object item)
{
// some logic
}
private void Item_Change(object item)
{
// some logic
}
private void Item_Remove()
{
// some logic
}
Now when I add meeting at that time Item_Add
event is called.
When I update that created meeting then Item_Change
event is fired 2 times.
I not able to get why it is firing 2 times.
Can any one give possible reason for it ?