Microsoft KB Archive/224872

= OL2000: DistListItem Doesn't Prompt to Save When Closed =

Article ID: 224872

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Outlook 2000 Standard Edition

-



This article was previously published under Q224872



SYMPTOMS
You used the AddMembers method on a distribution list item, but Outlook does not prompt you to save changes when you programmatically close the distribution list.



CAUSE
All of the following conditions are true:


 * You did not display the distribution list item before using the AddMembers method. -and-


 * You did not use the Save method to explicitly save the distribution list. -and-


 * You used the Close method with the olPromptForSave constant.



RESOLUTION
This problem is fixed in Microsoft Outlook 2002. This problem has also been fixed for Outlook 2000. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

273670 OL2000: Outlook Object Model Does Not Add or Remove Contacts



WORKAROUND
Use one of the following methods to work around this problem:
 * Use the DistListItem.Display method before using the AddMembers method.

-or-
 * Use the Save method to explicitly save the DistListItem.

-or-
 * Change another property of the DistListItem, such as the DLName, which will properly dirty the item so that it will save.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
If the DistListItem object is not displayed on the screen, then the item is not dirtied when you use the AddMembers method. Therefore, Outlook does not prompt to save changes when the DistListItem is closed.

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:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

Steps to Reproduce Problem
  Enter the following subroutine in Microsoft Outlook Visual Basic for Applications: Sub TestAddMembers

Dim myDLItem As DistListItem Dim myTempItem as MailItem Dim myTempRecipt As Recipients

Set myDLItem = CreateItem(olDistributionListItem) Set myTempItem = CreateItem(olMailItem) Set myTempRecipt = myTempItem.Recipients

' Change to a resolvable name myTempRecipt.Add "username"

myTempRecipt.ResolveAll

myDlItem.AddMembers myTempRecipt

myDLItem.Close olPromptForSave

End Sub  Run the TestAddMembers procedure.

You will not be prompted to save changes to the distribution list and the distribution list will not be saved in your Contacts folder.

