Share via


ContentMediaType Property

ContentMediaType Property

The ContentMediaType property contains type and subtype identifiers that specify the nature of the data in a body part.

Syntax

Property ContentMediaType as String
HRESULT get_ContentMediaType(BSTR* pVal);
HRESULT put_ContentMediaType(BSTR Val);

Remarks

The ContentMediaType property corresponds to the type and subtype of the Content-Type header field of Request for Comments (RFC) 2045.

This property corresponds to the urn:schemas:mailheader:content-type header field available in the Fields collection.

The format for the contents of the ContentMediaType property is <type>/<subtype>. Common types and subtypes include:

  • image/gif, image/jpeg
  • message/external-body, message/partial, message/rfc822
  • multipart/alternative, multipart/digest, multipart/mixed, multipart/related
  • text/html, text/plain

The following CdoContentTypeValues string constants are provided for use with the ContentMediaType property:

CdoContentTypeValues Module Constants

Constant Value Description

CdoGif

image/gif

Image encoded using Graphics Interchange Format (GIF)

cdoJpeg

image/jpeg

Image encoded using Joint Photographic Experts Group (JPEG) format (ISO/IEC 10918)

cdoMessageExternalBody

message/external-body

Pointer to message content outside this message

cdoMessagePartial

message/partial

One piece of a fragmented message

cdoMessageRFC822

message/rfc822

Simple e-mail message (not a forwarded message)

cdoMultipartAlternative

multipart/alternative

Different versions of same content, simplest version first

cdoMultipartDigest

multipart/digest

Different messages, including forwarded messages

cdoMultipartMixed

multipart/mixed

Body parts to be processed sequentially

cdoMultipartRelated

multipart/related

Body parts accessed through Uniform Resource Locators (URLs)

cdoTextHtml

text/html

Text with Hypertext Markup Language (HTML) tags

CdoTextPlain

text/plain

Unstructured text

The contents of ContentMediaType are case-insensitive. The default value is text/plain.

Example

Dim iBp as CDO.IBodyPart
    ' set a bodypart to oBp
iBp.ContentMediaType = "application/msword"