OL98: ReplyRecipients Property Is Read/Write, Not Read-only (198629)



The information in this article applies to:

  • Microsoft Outlook 98

This article was previously published under Q198629

SUMMARY

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.

MORE INFORMATION

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 a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: The following code demonstrates how to set the ReplyRecipients property of a MailItem object. Before using the following Visual Basic automation code:
  • Create a reference to the "Microsoft Outlook 98 Object Model."
  • Make necessary changes to the code as indicated in the comments below.
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
				

REFERENCES

For more information about creating solutions with Microsoft Outlook 98, please see the following articles in the Microsoft Knowledge Base:

180826 OL98: Resources for Custom Forms and Programming

182349 OL98: Questions About Custom Forms and Outlook Solutions


Modification Type:MajorLast Reviewed:5/13/2002
Keywords:kbbug kbMsg kbOutlookObj kbProgramming KB198629