C# and Outlook how - do I return the name and path of an Outlook Attachment

Posted on 2004-11-05
Last Modified: 2012-06-27
I use the Outlook MailItem to retrieve the values of the Email message.

How do I return the oEmail.Attachment - name and path ? Not sure how to cast it... thanks

                                                Outlook.MailItem oEmail = mail.LastSentItem();

                                                object[] rowVals = new object[11];
                                                DataRowCollection rc =  this.dsNotes.Tables["Interactions"].Rows;
                                                rowVals[2] = oEmail.SentOn;
                                                rowVals[3] = String.Concat("Sent:", oEmail.SentOn," Received: ",oEmail.ReceivedTime.ToShortDateString(),System.Environment.NewLine,oEmail.Subject);
                                                rowVals[4] = String.Concat("E-Mail:",System.Environment.NewLine,oEmail.Body);
                                                rowVals[8] = "Sent E-Mail";
                                                rowVals[9] =  oEmail.Attachments  ?????????????????????
                                                rowVals[10]= "E-Mail Message";
Question by:JElster
    LVL 11

    Accepted Solution

    once the file is attached to the mail, it looses the path - it becames part of the mail. in other words a copy of the original file is stored in mime format into the mail but any information about that file is lost - so you can not obtain the attached files path
    LVL 1

    Author Comment

    What about the file name ? Thanks
    LVL 1

    Author Comment

    What other info can I 'read'?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now