Article ID: 191365
Article Last Modified on 7/13/2004
' The following Visual Basic code sample assumes a reference to the CDO
' (1.2, 1.21) library (CDO.DLL).
' If you do not have this library please see the following
' article in the Microsoft Knowledge Base:
'
' ARTICLE-ID: Q171440
' TITLE : Where to Acquire the CDO (1.x) Libraries
'
' Paste the following code into a new BAS Module in a new Project:
Dim objSess As MAPI.Session
Dim objOrigMsg As Message
Dim objResendMsg As Message
Dim objAttach As Attachment
Sub Main()
'Create Session and Logon
Set objSess = CreateObject("mapi.session")
objSess.Logon
'Go get the NDR. For the sake of simplifying this sample,
'assume the NDR will be the first message in your Inbox.
Set objOrigMsg = objSess.Inbox.Messages.GetFirst
'Get a reference to the Attachment.
Set objAttach = objOrigMsg.Attachments.Item(1)
'Assign the Source Property of the Attachment to a previously
'defined Message object.
Set objResendMsg = objAttach.Source
'At this point the objResendMsg object is a COPY of the original
'message, including all of its properties, recipients, and
'attachments, and is programmatically available for subsequent
'manipulation.
End Sub
'----------------
The preceding code sample is not intended to represent a likely
implementation, but rather a snippet demonstrating only the elements
required to gain access to the original message.
Keywords: kbhowto kbmsg kbcode KB191365