Microsoft KB Archive/192083

= PRB: Setting PR_SENTMAIL_ENTRYID in CDO (1.x) Is Not Retained =

Article ID: 192083

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 Q192083



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 (1.1, 1.2, 1.21) application will not send the item you just sent to the specified folder.



CAUSE
The CDO (1.x) 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.



Steps to Reproduce Behavior
  Paste the following sample into a new Visual Basic Module: 'This code sample depends on a reference to the CDO '(1.1, 1.2, 1.21)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  Execute the code. 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.

Keywords: kbmsg kbprb kbcode KB192083

-

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

© Microsoft Corporation. All rights reserved.