static void ReadMail() { Outlook.Application oApp = new Outlook.Application(); Outlook.NameSpace oNS = oApp.GetNamespace("mapi"); oNS.Logon(Missing.Value,Missing.Value,false,true); Outlook.Recipient myRecipient = oNS.CreateRecipient("USERSMAILBOX"); myRecipient.Resolve(); Outlook.MAPIFolder oInbox = oNS.GetSharedDefaultFolder(myRecipient, Outlook.OlDefaultFolders.olFolderInbox); Outlook.Items oItems = oInbox.Items; Outlook.MailItem oMsg = (Outlook.MailItem)oItems.GetFirst(); MessageBox.Show(oMsg.Subject); oNS.Logoff(); oMsg = null; oItems = null; oInbox = null; oNS = null; oApp = null; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)