Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start Outlook with c#

Tags:

c#

.net

outlook

Can I make C# start Outlook in the code?

In VB6 we use object 'Outlook.Application' and write:'

Set oOutlook = CreateObject("Outlook.Application") 
Set oNameSpace = oOutlook.GetNamespace("MAPI") 
Set oInbox = oNameSpace.Folders(1) 
 'Set oInbox = oInbox.Folders("Inbox")
oInbox.Display 
 'oOutlook.Quit 'Close All Outlook copies

Copy/Paste from link: http://www.ozgrid.com/forum/showthread.php?t=73886

like image 531
jeje1983 Avatar asked May 05 '09 10:05

jeje1983


2 Answers

System.Diagnostics.Process will only start a process.

To do additional actions such choosing folders, you need to use Microsoft Visual Studio Tools for Office (VSTO). And here is it's reference. For example:

var outlook = new Microsoft.Office.Interop.Outlook.ApplicationClass();
outlook.Quit();
like image 177
abatishchev Avatar answered Sep 30 '22 17:09

abatishchev


If you just want to start the outlook; using System.Diagnostics.Process would be the easiest way. :)

like image 25
Chathuranga Chandrasekara Avatar answered Sep 30 '22 19:09

Chathuranga Chandrasekara