Adding Objects as attachments to mails in outlook using c#

  • Thread starter Thread starter dev
  • Start date Start date
D

dev

I have developed an add-in to outlook in c# using vs2005 and vsto. I
want to be able to attach objects (of a user -defined class) created in
the project to a mail item in c#. I would also appreciate it if you
could give me some - details on the use of the 4 attachment types in
outlook.
 
The only kind of attachments you can make programmatically with the Outlook object model embedded and linked files and Outlook items. If Word is the email editor, you may have other options through the Word.Document object returned by MailItem.GetInspector.WordEditor and its InlineShapes.Add method. (Sometimes the Word macro recorder can be your friend.)

As for the four Outlook.OlAttachmentType enumeration values:

olByReference Link to a file stored in the file system
olByValue File embedded in the Outlook item
olEmbeddedItem Outlook item embedded in the Outlook item
olOLE Content embedded using Object Linking and Embedding (OLE) technology

Only the first three can be used with Outlook's Attachments.Add method.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top