Outlook express access using C#

Asked By pampati praveen
04-Sep-02 10:32 PM
Earn up to 0 extra points for answering this tough question.
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

  All you need to do is backup

Asked By Peter Bromberg
05-Sep-02 04: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.

  Try this

Muhammad Deeraf replied to pampati praveen
02-Apr-08 08: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.

  Access Outlook Mails

Radha Rani replied to Muhammad Deeraf
01-Dec-08 08: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]

 

 

Create New Account