logo

Outlook express access using C#
pampati praveen posted at Wednesday, September 04, 2002 10:32 PM

HI,

I want to write small application which can backup outlook express. i.e i wnat to show to the user messages availbale and ask him to choose for backup and store the chosen messages. is it possible to do with C#? If so, How can i access outlook express and its messages in C# ? Please clarify me as soon as possible.

Thanking you

Regards
Praveen P
mailtopampati@rediffmail.com
Reply    Reply Using Power Editor
  Rank Winnings Points
February 0 $0.00 0
January 0 $0.00 0
All you need to do is backup
Peter Bromberg replied on Thursday, September 05, 2002 4:33 PM

the selected message stores using the filesystem:

For example, the Outlook Express Inbox for a given user is located:

 C:\Documents and Settings\[username]\Local Settings\Application Data\Identities\{GUID FOR IDENTITY}\Microsoft\Outlook Express\Inbox.dbx

Don't know of any way to access Outlook Express and its messages programmatically in any language because MS never put an object model in it, only in the "for pay"
MS Outlook that comes with MS Office.
Reply    Reply Using Power Editor
Peter Bromberg is a C# MVP, MCP, and .NET expert who has worked in banking, financial and telephony for over 20 years. Pete focuses exclusively on the .NET Platform, and currently develops SOA and other .NET applications for a Fortune 500 clientele. Peter enjoys producing digital photo collage with Maya,playing jazz flute, the beach, and fine wines. You can view Peter's UnBlog and IttyUrl sites. Pete Tweets at peterbromberg
  Rank Winnings Points
February 0 $0.00 0
January 0 $0.00 0

Try this
Muhammad Deeraf replied to pampati praveen on Wednesday, April 02, 2008 8:57 AM

Outlook made a local file for all messages(where is that file I have no idea may be in outlook folder).
If you understand the format of that file then you can get the messages which are checked by the user from the file and save it to another file in the same format.

Reply    Reply Using Power Editor
  Rank Winnings Points
February 0 $0.00 0
January 0 $0.00 0

Access Outlook Mails
Radha Rani replied to Muhammad Deeraf on Monday, December 01, 2008 8:14 AM

Hi. you can use the below code to access outlook mails..

[CODE]

 using Outlook;

 Outlook.Application oOutlook;
 Outlook.NameSpace oNs;
 Outlook.MAPIFolder oFldr;
 long iAttachCnt;

 try
 {
     oOutlook = new Outlook.Application();
     oNs = oOutlook.GetNamespace(”MAPI”);

     //getting mail folder from inbox
     oFldr = oNs.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
     Response.Write(”Total Mail(s) in Inbox :” + oFldr.Items.Count + “<br>”);
     Response.Write(”Total Unread items = ” + oFldr.UnReadItemCount);
     foreach (Outlook.MailItem oMessage in oFldr.Items)
     {
         StringBuilder str = new StringBuilder();
         str.Append(”<table style=’border:1px solid gray;font-family:Arial;font-size:x-small;width:80%;’ align=’center’><tr><td style=’width:20%;’><b>Sender :</b></td><td>”);
         str.Append(oMessage.SenderEmailAddress.ToString() + “</td></tr>”);
         //basic info about message
         str.Append(”<tr><td><b>Date :</b></td><td>” + oMessage.SentOn.ToShortDateString() + “</td></tr>”);
         if (oMessage.Subject != null)
         {
             str.Append(”<tr><td><b>Subject :</b></td><td>” + oMessage.Subject.ToString() + “</td></tr>”);
         }
         //reference and save all attachments

         iAttachCnt = oMessage.Attachments.Count;
         if (iAttachCnt > 0)
         {
             for (int i = 1; i <= iAttachCnt; i++)
             {
                 str.Append(”<tr><td><b>Attachment(” + i.ToString() + “) :</b></td><td>” + oMessage.Attachments[i].FileName + “</td></tr>”);
             }
         }
         str.Append(”</table><br>”);
         Response.Write(str.ToString());

     }

 }
 catch (System.Exception ex)
 {
     Response.Write(”Execption generated:” + ex.Message);
 }
 finally
 {
     GC.Collect();
     oFldr = null;
     oNs = null;
     oOutlook = null;

 }

[CODE]

 

 

Reply    Reply Using Power Editor
  Rank Winnings Points
February 0 $0.00 0
January 0 $0.00 0


Didn't Find The Answer You Were Looking For?

EggHeadCafe has experts online right now that may know the answer to your question.  We pay them a bonus for answering as many questions as they can.  So, why not help them and yourself by becoming a member (free) and ask them your question right now?
Ask Question In Live Forum

If you have an OpenID and do not want to become a member of the EggHeadCafe forum, you can also sign on to Chat Chaos and post your question to our real time Silverlight chat application.
Ask Question In Chat Chaos










  $1000 Contest    [)ia6l0 iii - $228  |  Jonathan VH - $161  |  Huggy Bear - $135  |  F Cali - $95  |  egg egg - $94  |  more Advertise  |  Privacy  |   (c) 2010