OL98: ReplyRecipients Property Is Read/Write, Not Read-onlyID: Q198629
|
The Outlook Visual Basic Reference (Vbaoutl.hlp) incorrectly states the ReplyRecipients property of a MailItem object is read-only. The property is actually read/write.
Microsoft provides programming examples for illustration only, without
warranty either expressed or implied, including, but not limited to, the
implied warranties of merchantability and/or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language being demonstrated and the tools used to create and debug
procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to
provide added functionality or construct procedures to meet your specific
needs. If you have limited programming experience, you may want to contact
the Microsoft fee-based consulting line at (800) 936-5200. For more
information about the support options available from Microsoft, please see
the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/The following code demonstrates how to set the ReplyRecipients property of a MailItem object. Before using the following Visual Basic automation code:
Sub AddReplyRecipients()
Dim oApp As Outlook.Application
Dim oNS As Outlook.NameSpace
Dim oUser1 As Outlook.Recipient
Dim oUser2 As Outlook.Recipient
Dim oMyItem As Outlook.MailItem
Set oApp = New Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
Set oMyItem = oApp.CreateItem(olMailItem)
oMyItem.Subject = "test"
oMyItem.Body = "Hello, body"
' replace "User1" with a valid e-mail alias
Set oUser1 = oNS.CreateRecipient("User1")
oUser1.Resolve
oMyItem.ReplyRecipients.Add oUser1
' replace "User2" with a valid e-mail alias
Set oUser2 = oNS.CreateRecipient("User2")
oUser2.Resolve
oMyItem.To = oUser2
oMyItem.Send
Set oMyItem = Nothing
Set oUser1 = Nothing
Set oUser2 = Nothing
Set oNS = Nothing
Set oApp = Nothing
End Sub
For more information about creating solutions with Microsoft Outlook 98,
please see the following articles in the Microsoft Knowledge Base:
Q180826 OL98: Resources for Custom Forms and Programming
Q182349 OL98: Questions About Custom Forms and Outlook Solutions
Additional query words: kbMsg kbOutlookObj kbOutlook97 kbOutlook98 OutSol98 vbscript 98
Keywords : kbdta kbMsg kbOutlook98 kbOutlookObj
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: April 9, 1999