BUG: CDO: Copying or Moving Hidden Messages Makes Them Visible (266734)



The information in this article applies to:

  • Collaboration Data Objects (CDO) 1.1
  • Collaboration Data Objects (CDO) 1.2
  • Collaboration Data Objects (CDO) 1.21

This article was previously published under Q266734

SYMPTOMS

When you use the MoveTo or CopyTo method of the Collaboration Data Objects (CDO) Message object on a hidden message, the message may appear in the destination folder as a visible message.

CAUSE

The MoveTo and CopyTo methods of the Message object in the CDO library do not differentiate between hidden and nonhidden messages. Any hidden message that is either copied or moved will be visible in the destination folder.

STATUS

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

MORE INFORMATION

Steps to Reproduce Behavior

  1. Open a new Microsoft Visual Basic project.
  2. Add a button to the form. (The name of the button is Command1 by default.)
  3. Make a reference to the Microsoft CDO 1.21 library.
  4. In the Click event of the button, paste the following code:
    Option Explicit
    
    Private Sub Command1_Click()
        Dim objSession As Session
        Dim objHiddenMsgs As Messages
        Dim objHiddenMsg As Message
        Dim objHiddenMsgMove As Message
        Dim objFolderSource As Folder
        Dim objFolderDest As Folder
        
        ' Log on to the CDO session.
        Set objSession = CreateObject("MAPI.Session")
        objSession.Logon
    
        ' Delete the messages in the Hiddenmessages collection for the TestSource folder.
        Set objFolderSource = objSession.Inbox.Folders("TestSource")
        ' Debug.Print "Source Folder : " & objFolderSource.Name
        Set objHiddenMsgs = objFolderSource.HiddenMessages
        objHiddenMsgs.Delete
        
        ' Delete the messages in the Hiddenmessages collection for the TestDest folder.
        Set objFolderDest = objSession.Inbox.Folders("TestDest")
        ' Debug.Print "Dest Folder : " & objFolderDest.Name
        Set objHiddenMsgs = objFolderDest.HiddenMessages
        objHiddenMsgs.Delete
    
        ' Add a new hidden message in the TestSource folder.
        Set objHiddenMsg = objFolderSource.HiddenMessages.Add
        objHiddenMsg.Subject = "Test Hidden Message"
        objHiddenMsg.Text = "This the Message body..."
        objHiddenMsg.Update
        
        ' Check the hidden messages before move.
        Debug.Print "Before Move :"
        Debug.Print "TestSource contains " & _
                    objFolderSource.HiddenMessages.Count & " hidden messages"
        Debug.Print "TestDest contains " & _
                    objFolderDest.HiddenMessages.Count & " hidden messages"
        
        ' Move the hidden message from TestSource folder to TestDest folder.
        Set objHiddenMsgMove = objHiddenMsg.MoveTo(objFolderDest.ID)
        objHiddenMsgMove.Update
        
        ' Check the hidden messages after move.
        Debug.Print "After Move :"
        Debug.Print "TestSource contains " & _
                    objFolderSource.HiddenMessages.Count & " hidden messages"
        Debug.Print "TestDest contains " & _
                    objFolderDest.HiddenMessages.Count & " hidden messages"
        
        ' Log off.
        objSession.Logoff
        
        ' Claen up.
        Set objSession = Nothing
        Set objHiddenMsgs = Nothing
        Set objHiddenMsg = Nothing
        Set objHiddenMsgMove = Nothing
        Set objFolderSource = Nothing
        Set objFolderDest = Nothing
        Unload Me
    End Sub
    					
  5. Start Microsoft Outlook and create two folders named TestSource and TestDest under the Inbox folder.
  6. Press F5 to run the code.
Results from Immediate window:

Before Move :
TestSource contains 1 hidden messages
TestDest contains 0 hidden messages
After Move :
TestSource contains 0 hidden messages
TestDest contains 0 hidden messages

Expected results:

Before Move :
TestSource contains 1 hidden messages
TestDest contains 0 hidden messages
After Move :
TestSource contains 0 hidden messages
TestDest contains 1 hidden messages


Modification Type:MinorLast Reviewed:3/4/2004
Keywords:kbBug kbMsg KB266734