Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi
Could somebody show me how to code a program to read a new email in MS outlook 2003. I code my project in C# to interface with MSoutlook 2003. Which right now i could get it to display the subject of the email. But my next problem is every thing i try to get the sender name or email address. I would pop-up a warning. Is there other way to do this. If you don't understand my question please let me know. Thank you.here is my code so far
Outlook.Application oApp = new Outlook.ApplicationClass();
Outlook.NameSpace oNS = (Outlook.NameSpace)oApp.GetNamespace("mapi");
oNS.Logon(null, null, true, true);Outlook.MAPIFolder oInbox = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
foreach(object obj in oInbox.Items)
{
Outlook.MailItem item = obj as Outlook.MailItem;
if(item != null)
{
if(item.UnRead == true)
{
textBox1.Text = item.SenderName;
}
}
}

![]() |
C++ String Project?
|
Linker Error: Undefined S...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |