Microsoft KB Archive/169031: Difference between revisions
m (Text replacement - "[[../mapi/q" to "[[../") |
m (Text replacement - """ to """) |
||
Line 84: | Line 84: | ||
<blockquote>[[../176916|Q176916]] INFO: Active Messaging and Collaboration Data Objects (1.x)</blockquote> | <blockquote>[[../176916|Q176916]] INFO: Active Messaging and Collaboration Data Objects (1.x)</blockquote> | ||
Microsoft Developer Network, Platform SDK, | Microsoft Developer Network, Platform SDK, "Source Property (Attachment Object)" | ||
Additional query words: | Additional query words: |
Latest revision as of 10:04, 21 July 2020
HOWTO: Embed a Document in a Message Using CDO (1.x) |
Q169031
The information in this article applies to:
- Collaboration Data Objects (CDO), versions 1.0a, 1.1, 1.2, 1.21
SUMMARY
Using CDO (1.x), it is possible to embed a file in a message so that the contents of the file are viewed when the message is opened--for example, embedding a bitmap into the message so that the actual bitmap appears when you open the message.
MORE INFORMATION
The code provided is a sample of performing this task in Microsoft Visual Basic.
Steps to Embed a File in a Message
- Create a MAPI Session object and call the Logon method:
- Create a Message and Attachment object:
- Set the Type property of the Attachment to indicate an OLE object:
- For Collaboration Data Objects (CDO) versions 1.0 and 1.1 only:
Set the Source property of the Attachment to the class of the OLE object:
- Use the ReadFromFile method of the Attachment to load the contents of the file for the OLE object and the Update method of the Message to save both the Attachment and the message:
- Send the Message:
- Call the Logoff method of the session:
Other Types of Message Attachments
Below are the four types of attachments that may be specified for a message and the corresponding Active Messaging 1.1 constants used when assigning the Type property of the attachment:
- The contents of a file (you see an icon in the message representing the data in the file), ActMsgFileData
- A link to a file (usually on a file server), ActMsgFileLink
- An OLE object (example above), ActMsgOLE
- An embedded message, ActMsgEmbeddedMessage
The return value or setting of the Source property depends on the value of the Type property, as described in the following table:
Type property Source property ---------------- --------------------------------------------- ActMsgFileData Specifies the full path of the file that will be attached when the ReadFromFile method is called later. It is not necessary to set this property if the source is specified in the call to the Add method of the Attachments collection. ActMsgFileLink Specifies a full path name in a universal naming convention (UNC) format, such as \\Sales\Info\Product\News.doc. ActMsgOLE Specifies the registered OLE class name of the attachment, such as Word.Document or PowerPoint.Show. The actual file contents would be loaded with the ReadFromFile method. ActMsgEmbeddedMessage Specifies the unique identifier of the message to be embedded; returns the embedded Message object.
REFERENCES
For additional information about Collaboration Data Objects (1.x) versus Active Messaging, please see the following article in the Microsoft Knowledge Base:
Q176916 INFO: Active Messaging and Collaboration Data Objects (1.x)
Microsoft Developer Network, Platform SDK, "Source Property (Attachment Object)"
Additional query words:
Keywords : kbcode kbActMsg kbCDO100 kbCDO110 kbCDO120 kbCDO121 kbMsg kbOLEMsg kbGrpDSMsg
Issue type : kbhowto
Technology : kbAudDeveloper kbCDOsearch kbExchangeSearch kbCDO100a kbCDO110 kbCDO120 kbCDO121
Last Reviewed: April 29, 2000 |