Search code examples
c#outlookoutlook-addinoutlook-2010

how to check whether compose mail popup(Window)open or not in outlook using c#


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

note:i am using outlook 2010.


Solution

  • 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