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

Last reviewed: March 2, 1998
Article 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 engineers 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/default.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:

   Article-ID: Q169750
   Title     : 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:

   Article-ID: Q166368
   Title     : OL97: How to Get Help Programming with Outlook

   Article-ID: Q170783
   Title     : 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
Solution Type : kbpending


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.