Adding Objects as attachments to mails in outlook using c#

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.
 
S

Sue Mosher [MVP-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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top