Share via


FileName Property

FileName Property

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.

The FileName property corresponds to the filename parameter attribute used with the Content-Disposition Multipurpose Internet Mail Extensions (MIME) header field. This property is read-only.

Applies To

IBodyPart Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

[Visual Basic]Property FileName As String

[C++]HRESULT get_FileName(BSTRpVal);

Parameters

  • pVal
    Returns the value of the FileName property as a reference to a BSTR.

Remarks

The FileName property corresponds to the filename attribute parameter of the Content-Disposition header field of RFC 2183.

Some applications may interpret the Content-Disposition header field specified as a file to mean that a body part is an attachment. However, there is no specifically-defined presentation behavior determined by the FileName property.

The default value of FileName is an empty string. If Collaboration Data Objects (CDO) does not recognize the disposition of a body part on an incoming message, it is treated as an attachment.

Example

All message attachments are contained in objects that implement the IBodyPart interface. In the following example, the attachments are enumerated, and all associated file names gathered. These names could be used to render attachment bitmaps in a Upgrade Advantage, save it into a file with this name, or make a guess as to its type if, for example, the attachment had Content-Type equal to "application/octet-stream."

[Visual Basic]

Sub ProcessAttachments(iMsg As CDO.Message) Dim iBp As CDO.BodyPart Dim Filename As String Dim Atchmts As CDO.IBodyParts Set Atchmts = iMsg.Attachments

' Note that all attachments are contained in body ' parts -- the collection object ' exposes the IBodyParts interface. If Atchmts.Count > 0 Then For Each iBp In iMsg.Attachments Filename = iBp.Filename If Not Filename = "" Then

  ' Use the file name
  End If
Next iBp

End If End Sub

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.