locked
Downloading outlook attachement RRS feed

  • Question

  • Hi,

    I am trying to check the outlook inbox for uread email and if there is any unreda email then I have to save the attachement on some other location using C#. I can read all the unread email but I am strugglling in downloading the attachement, I dont know how to do it . Any help.
    Thanks

    Tuesday, November 18, 2008 2:56 PM

Answers

  • Hi,

     If you use the Microsoft Outlook 11.0 Object Library, you can use the following code snippet to save the attachment:
    oMsg.Attachments[1].SaveAsFile("c:\\" + oMsg.Attachments[1].FileName); 
    oMsg is MailItem.
    And the Attachments first index is "1",
     If you use the Microsoft Outlook 10.0 Object Library, you can use Attachments.Item(1) to get the first attachment.

    Best regards,
    Harry
    • Proposed as answer by Harry Zhu Thursday, November 20, 2008 7:06 AM
    • Marked as answer by Harry Zhu Monday, November 24, 2008 2:00 AM
    Thursday, November 20, 2008 7:05 AM