Microsoft KB Archive/266734

= BUG: CDO: Copying or Moving Hidden Messages Makes Them Visible =

Article ID: 266734

Article Last Modified on 3/4/2004

-

APPLIES TO


 * Microsoft Collaboration Data Objects 1.1
 * Microsoft Collaboration Data Objects 1.2
 * Microsoft Collaboration Data Objects 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.



Steps to Reproduce Behavior
 Open a new Microsoft Visual Basic project. Add a button to the form. (The name of the button is Command1 by default.) Make a reference to the Microsoft CDO 1.21 library.  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(&quot;MAPI.Session&quot;) objSession.Logon

' Delete the messages in the Hiddenmessages collection for the TestSource folder. Set objFolderSource = objSession.Inbox.Folders(&quot;TestSource&quot;) ' Debug.Print &quot;Source Folder : &quot; & objFolderSource.Name Set objHiddenMsgs = objFolderSource.HiddenMessages objHiddenMsgs.Delete ' Delete the messages in the Hiddenmessages collection for the TestDest folder. Set objFolderDest = objSession.Inbox.Folders(&quot;TestDest&quot;) ' Debug.Print &quot;Dest Folder : &quot; & objFolderDest.Name Set objHiddenMsgs = objFolderDest.HiddenMessages objHiddenMsgs.Delete

' Add a new hidden message in the TestSource folder. Set objHiddenMsg = objFolderSource.HiddenMessages.Add objHiddenMsg.Subject = &quot;Test Hidden Message&quot; objHiddenMsg.Text = &quot;This the Message body...&quot; objHiddenMsg.Update ' Check the hidden messages before move. Debug.Print &quot;Before Move :&quot; Debug.Print &quot;TestSource contains &quot; & _ objFolderSource.HiddenMessages.Count & &quot; hidden messages&quot; Debug.Print &quot;TestDest contains &quot; & _ objFolderDest.HiddenMessages.Count & &quot; hidden messages&quot; ' 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 &quot;After Move :&quot; Debug.Print &quot;TestSource contains &quot; & _ objFolderSource.HiddenMessages.Count & &quot; hidden messages&quot; Debug.Print &quot;TestDest contains &quot; & _ objFolderDest.HiddenMessages.Count & &quot; hidden messages&quot; ' 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  Start Microsoft Outlook and create two folders named TestSource and TestDest under the Inbox folder. Press F5 to run the code.</li></ol>

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

Additional query words: hidden message collection

Keywords: kbbug kbmsg KB266734

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.