Platform SDK: Exchange 2000 Server

GetFieldParameter Method

[This is preliminary documentation and subject to change.]

Returns the value of the specified parameter for the specified MIME header field.

[Visual Basic]
Function GetFieldParameter(FieldName as String, Parameter as String) as String
[C++]
HRESULT GetFieldParameter(BSTR FieldName, BSTR Parameter, BSTR* pVal);
[IDL]
HRESULT GetFieldParameter([in] BSTR FieldName, [in] BSTR Parameter, [out,retval] BSTR* pVal);
FieldName
The fully qualified name of the field, such as "urn:schemas:mailheader:content-type." CDO string constants are provided for the various field names, such as cdoContentDisposition.
Parameter
The name of the parameter, such as "filename" or "boundary."

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.

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


Sub 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 Sub