Reputation: 111
I have Windows.Forms application from which i need to open Outlook and programmatically fill address and subject. After this:
Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
oMailItem.To = sto;
oMailItem.Subject = sid;
oMailItem.Display(true);
Outlook blocks access to the Windows.Forms application. But I need to copy some data from Windows.Forms app manually to the email body. I can't find good solution. I'd appreciate any help.
Upvotes: 1
Views: 289
Reputation: 8786
need to use: oMailItem.Display();
Display(Modal): True to make the window modal. The default value is False.
Upvotes: 2
Reputation: 658
Change your last line to:
oMailItem.Display(false);
The modal argument means that the form will be blocked by the mail window
Upvotes: 3