Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

PRB: ContentClass and Custom Properties Not Supported at Attachment Body Part


View products that this article applies to.

This article was previously published under Q296726

↑ Back to the top


Symptoms

Messages that are formatted according to the Multipurpose Internet Mail Extensions (MIME) specification are divided into parts. The top part is referred to as the root, and additional parts are referred to as body parts. You can set the content class and the custom property on the attachment body part. When the sendusing field is set to the cdoSendUsingExchange enumeration, the content class and custom property do not persist to the MIME stream of the received message.

↑ Back to the top


Cause

Setting the content class and custom properties is not supported on the attachment body part level. Setting these properties is only supported at the root of the message.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. In Microsoft Visual Basic, create a new Standard EXE project.
  2. Add a button to the default form and paste the following code into the button's Click event:
        Dim iMsg As CDO.Message
        Dim iConf As CDO.Configuration
        Dim iBp As CDO.IBodyPart
        Dim Flds As Fields
        Dim Strm As Stream
      
        Set iMsg = CreateObject("CDO.Message")
        Set iConf = iMsg.Configuration
        iConf("http://schemas.microsoft.com/cdo/configuration/sendusing") _
            = cdoSendUsingExchange
        iConf.Fields.Update
        
        'TO DO: Change From and To
        iMsg.To = "someone@somewhere.com"
        iMsg.From = "someone@somewhere.com"
        iMsg.Subject = "subject"
        iMsg.TextBody = "text body"
        Set iBp = iMsg.AddAttachment("")
        iBp.ContentClass = "urn:somewhere:mycc"
        Set Flds = iBp.Fields
        Flds("urn:schemas:mailheader:content-type") = "text/html"
        Flds("urn:schemas:mailheader:content-class") = "urn:somewhere:mycc"
        Flds("urn:schemas:mailheader:mycustomprop") = "myproperty"
        Flds.Update
        Set Strm = iBp.GetDecodedContentStream
        Strm.WriteText "Attachment body part new text", adWriteLine
        Strm.Flush
        iMsg.Fields.Update
        iMsg.Send
        Set iMsg = Nothing
     
    					
  3. Change the e-mail address of iMsg.To and iMsg.From in the code.
  4. Add a reference to Microsoft CDO For Exchange 2000 Library and Microsoft ActiveX Data Objects 2.5 Library.
  5. Run the program and click the button to send the message.
  6. Observe the MIME stream of the received message. The attachment body part's ContentClass property and urn:schemas:mailheader:mycustomprop custom property are not persisted.

↑ Back to the top


Keywords: KB296726, kbprb, kbmsg

↑ Back to the top

Article Info
Article ID : 296726
Revision : 6
Created on : 2/22/2007
Published on : 2/22/2007
Exists online : False
Views : 373