Scalabium Software |
|
Knowledge for your independence'. | |
Home Delphi and C++Builder tips |
#123: How can I retrieve and save the attachments from MS Outlook message? |
|
I want to continue the postings about MS Outlook programming
in Borland Delphi. Each message have the Attachments collection which contains a list of files. As usual collection, the Attachments property have the Count property where you can read a number of files and access to each file using Item method. For example, in code below you'll see how to add in TListView component the rows for each attachment file: for i := 1 to itemOL.Attachments.Count do with lvAttachments.Items.Add do Caption := itemOL.Attachments.Item(i); Of course, don't forget that VB's collection have the 1 as starting index. Also each item in Attachments collection have the SaveAsFile method which allow to save an attachment into file on disk. The parameter of SaveAsFile is a desired file name. itemOL.Attachments.Item(i).SaveAsFile(itemOL.Attachments.Item(i)); I prepeared a small demo application where I included all described tips for MS Outlook programming. You can download this project with sources: http://www.scalabium.com/faq/delphioutlook.zip (150Kb) PS: if you'll have some questions or suggestions, please contact me
|
|
Copyright© 1998-2024, Scalabium
Software. All rights reserved. |