Home > DeveloperSection > Forums > How can I open outlook message window in wpf?
Brad Pitt
Brad Pitt

Total Post:61

Points:429
Posted on    August-19-2013 7:29 AM

 WPF WPF 
Ratings:


 1 Reply(s)
 3358  View(s)
Rate this:
Hi!

I have a wpf application and I'd like it to use Outlook to send messages any user.

I don't want to send them programmatically though; I just want to open

The New Message window, set the recipients and leave it there for the

User to finish filling out.

What classes am I looking for?

please help me thanks in advance!



shreesh chandra shukla
shreesh chandra shukla

Total Post:105

Points:735
Posted on    August-19-2013 8:11 AM

Hi!

You can firstly add reference to the Outlook Interop and after that write below line of code where you want to open a Outlook message window in wpf.

Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application();

            Microsoft.Office.Interop.Outlook.MailItem message =

            (Microsoft.Office.Interop.Outlook.MailItem)outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);

            message.Subject = "Testing Mail!";

            message.Recipients.Add("some@email.com");

            message.Body = "Hello. This is body area, write your mail here.";

            //int attachmentLocation = 1;

            //message.Attachments.Add(fileName, Outlook.OlAttachmentType.olByValue,attachmentLocation, displayName);

            message.Display(false);

thanks.


Don't want to miss updates? Please click the below button!

Follow MindStick