GetFieldParameter Method

GetFieldParameter Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Returns the value of the specified parameter for the specified Multipurpose Internet Mail Extensions (MIME) header field.

Applies To

IBodyPart Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

[Visual Basic]Function GetFieldParameter
(
    FieldName As String,     Parameter As String
) As String

[C++]HRESULT GetFieldParameter (     BSTR FieldName,     BSTR Parameter,     BSTRpVal );

Parameters

  • FieldName
    The fully qualified name of the field, such as urn:schemas:mailheader:content-type. Collaboration Data Objects (CDO) string constants are provided for the various field names, such as cdoContentDisposition.
  • Parameter
    The name of the parameter, such as "filename" or "boundary."
  • pVal
    The charset field returned as a reference to a BSTR.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

The GetFieldParameter method can be used to access parameters for MIME fields that contain nested information. One example is the standard MIME header Content-Disposition (the fully resolved name for CDO is urn:schemas:mailheader:content-disposition). When the content disposition is set to "attachment", the field value normally contains a "filename=[name]" portion to indicate to the receiver suggested names to use when storing the content on the file system. You can use the GetFieldParameter to directly access this value, rather than having to parse the string yourself.

Example

This example demonstrates using GetFieldParameter to extract the charset parameter from a Content-Type: text/plain mail header and the border parameter from a Content-Type: multipart header. The Charset property does the first one for you.

[Visual Basic]

Function GetCharset(ByRef iBp As CDO.IBodyPart) As String GetTextBodyCharset = iBp.GetFieldParameter("urn:schemas:mailheader:content-type", "charset") End Function

Function GetMultipartBoundary(iBp As CDO.IBodyPart) As String If InStr(0, iBp.ContentMediaType, "multipart") > 1 Then GetMultipartBoundary = iBp.GetFieldParameter("urn:schemas:mailheader:content-type", "boundary") Else GetMultipartBoundary = "" End If End Function

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.