-4

anyone know how to check whether the outlook new(Compose) mail window(popup) opened or not using c#?

note:i am using outlook 2010.

Arjun babu
  • 607
  • 2
  • 13
  • 42

1 Answers1

1

I don't know if I understood well your question but you could try something like:

//Check if the active inspector is a MailItem.
if(App.ActiveInspector().CurrentItem is OutlookApi.MailItem){
  //do something.
}

Or you can use the event ItemLoad

private void OnItemLoad(OutlookApi.COMObject item){
{
  if (item is OutlookApi.MailItem){
    //do something
  }
}

I hope that this can help you.

Regards

Pedro Gandola
  • 196
  • 1
  • 11
  • Thanks Pedro.But how to i get mailitem.EntryId without using Inspector. or how to get current Active inspector in Inspector.CurrentItem? – Arjun babu Oct 30 '13 at 12:33
  • 1
    You have a method in Application interface called [ActiveInspector](http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._application.activeinspector.aspx) that returns the topmost inspector. [Here](http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._application_members.aspx) you have the allowed operations and properties that you can access using the Outlook Application interface. – Pedro Gandola Oct 30 '13 at 13:31
  • i got it.thanks for ur relpy Pedro.Outlook.MailItem item = (Outlook.MailItem)Globals.ThisAddIn.Application.ActiveInspector().CurrentItem; – Arjun babu Oct 30 '13 at 13:52