PRB: Setting PR_SENTMAIL_ENTRYID in CDO is Not Retained

ID: Q192083


The information in this article applies to:
  • Collaboration Data Objects (CDO), versions 1.1, 1.2, 1.21


SYMPTOMS

When sending a message, by default, a copy is saved to a folder (by default this is the Sent Items Folder). The Extended Messaging Application Programming Interface (MAPI) exposes a field called PR_SENTMAIL_ENTRYID on the Message that allows this folder to be set to something other than Sent Items.

Setting this field on a new message generated by a Collaboration Data Objects (CDO) application will not send the item you just sent to the specified folder.


CAUSE

The CDO library hard codes the value placed in the PR_SENTMAIL_ENTRYID field to the Sent Items Folder, overwriting any previously existing value.


RESOLUTION

After sending the mail, execute a MoveTo against the copy in the Sent Items Folder, moving it to the desired folder.


STATUS

This behavior is by design.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Paste the following sample into a new Visual Basic Module:
    
          'This code sample depends on a reference to the CDO library,
          'otherwise known as the Collaboration Data Objects library.
          'If you do not have this library, please see the following article
          'in the Microsoft Knowledge Base:
    
          '   ARTICLE-ID: Q171440
          '   TITLE     : Info: Where to Acquire Collaboration Data Objects
                          Library
          '
          Dim objSess As MAPI.Session
          Dim objOutbox As Folder
          Dim objMsg As Message
          Dim strENTRYID As String
    
          Sub main()
             Set objSess = CreateObject("mapi.session")
             objSess.Logon
             Set objOutbox = objSess.Outbox
             Set objMsg = objOutbox.Messages.Add
             With objMsg
                .Text = "Nothing here."
                .Subject = "Save this sent message to an " & _
                           "alternalte Folder rather than Sent Items!!!"
                'Add field and populate with EntryID of Deleted Items Folder
                strENTRYID = _
                   objSess.GetDefaultFolder(CdoDefaultFolderDeletedItems).ID
                .Fields.Add CdoPR_SENTMAIL_ENTRYID, strENTRYID
                .Recipients.Add Name:="MyEmailName"
                .Recipients.Resolve
                .Send
             End With
          End Sub 


  2. Execute the code.


  3. You will find the mail you received in your Inbox, but the mail that was sent shows up in your Sent Items Folder regardless of the ENTRYID with which you populate the PR_SENTMAIL_ENTRYID.


Additional query words:

Keywords : kbCDO110 kbCDO120 kbCDO121 kbMsg
Version : WINDOWS:1.1,1.2,1.21
Platform : WINDOWS
Issue type : kbprb


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