OL97: Cannot Programmatically Change Contact's E-mail Address

ID: Q173588


The information in this article applies to:
  • Microsoft Outlook 97


SYMPTOMS

Using Microsoft Visual Basic Scripting Edition (VBScript) or Microsoft Visual Basic for Applications, you cannot change the e-mail address of a Microsoft Outlook 97 contact.


WORKAROUND

There is no known workaround available.


STATUS

Microsoft has confirmed this to be a problem in Microsoft Outlook. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


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 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/overview/overview.asp
You can write VBScript or Visual Basic for Applications code to initially set a contact's e-mail address. In other words, if the e-mail address field (typically Email1Address) does not have a value, then the e-mail address can be programmatically changed. If the field already contains an e-mail address, however, the value of the e-mail field will not change and you will not receive an error message.

The following Visual Basic for Applications automation code illustrates the problem:

    Sub ChangeEmailAddress()

      ' The Outlook object library must be referenced.
      Dim ol As New Outlook.Application
      Dim myContact As ContactItem

      ' Create a new Contact item.
      Set myContact = ol.CreateItem(olContactItem)
      myContact.FullName = "Joe Smith"

      ' This will properly set the email address.
      myContact.Email1Address = "joe@abc.com"
      myContact.Save

      ' This will not change the email address.
      myContact.Email1Address = "mike@xyz.com"
      myContact.Save

      ' The email address appears to be changed here...
      MsgBox myContact.Email1Address

      ' ...but it is not actually changed.
      myContact.Display

   End Sub 
Note that programmatically, the Email1Address will properly return the second e-mail address (mike@xyz.com) until the first e-mail address is resolved.


REFERENCES

For more information on programmatically resolving e-mail addresses, please see the following article in the Microsoft Knowledge Base:

Q169750 OL97: How to Programmatically Resolve a Contact's E-mail Address
For more information about creating solutions with Microsoft Outlook 97, please see the following articles in the Microsoft Knowledge Base:
Q166368 OL97: How to Get Help Programming with Outlook

Q170783 OL97: Q&A: Questions about Customizing or Programming Outlook

Additional query words: OutSol OutSol97

Keywords : kbcode kbprg
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: November 13, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.