Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in windows forms i am able to read outlook mails using office interop dlls

Outlook._Application olApp = new Outlook.Application();
Outlook._NameSpace olNs;
Outlook.MAPIFolder oSents;
olNs = olApp.GetNamespace("MAPI");
oSents = olNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Outlook.Items oItems;
oItems = oSents .Items;
DateTime RDateTime;
C#
for (int count = oItems.Count; count >= 1; count--)
                {
                    try
                    {
                        Microsoft.Office.Interop.Outlook._MailItem oMICopy = oItems[count] as Microsoft.Office.Interop.Outlook._MailItem;
                        oMICopy = (Outlook._MailItem)oItems[count];
                        RDateTime = oMICopy.ReceivedTime;
                        subject = oMICopy.Subject;
                        string MailBody = oMICopy.HTMLBody;
}



But in c# windows services i am unable to connect to outlook with local system accout.

please help me...
Posted

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900