ToKar
ToKar

Reputation: 59

Minimize "new Email" Dialog

I try to modify a new email. Everything works fine but i want to minimize the "new Email" Dialog in Outlook during the modification and i don't know where to do this.

This is my code so far:

public Outlook.MailItem convertMail()
{                 
    mail.Subject = "New subject";
    mail.Body =  "This is the test text";        
    return mail;
}

I already tried:

mail.Display(false);

This doesnt work and i don't know which function to use. How can i minimize the Outlook Dialog by code?

Upvotes: 1

Views: 192

Answers (2)

Cee McSharpface
Cee McSharpface

Reputation: 8725

The window state of the message composer is not a property of the mail item, but of its inspector:

var inspector = mail.GetInspector;
inspector.WindowState = OlWindowState.olMinimized;

This assumes that the window is already shown on screen by the time this code executes. Otherwise, call inspector.Display(false) before you set the window state.

Upvotes: 3

Andy G
Andy G

Reputation: 19367

From Outlook Interop I believe the nearest you could get is:

outlookApp.Inspector inspect;
inspect = mail.GetInspector;
inspect.Display;
inspect.WindowState = olMinimized; // probably outlookApp.olMinimized

(although I cannot test currently)

Upvotes: 1

Related Questions