Platform SDK: CDO for Windows 2000 |
The FileName property corresponds to the file name parameter attribute used with the Content-Disposition Multipurpose Internet Mail Extensions (MIME) header field.
[Visual Basic] Property FileName as String read-only [C++] HRESULT get_FileName(BSTR* pVal); [IDL] HRESULT [propget] FileName([out,retval] BSTR* pVal);
The FileName property corresponds to the file name attribute parameter of the Content-Disposition header field of Request for Comments (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 Microsoft Collaboration Data Objects (CDO) does not recognize the disposition of a body part on an incoming message, it is treated as an attachment.
All message attachments are contained in objects that implement the IBodyPart interface. In the example below, the attachments are enumerated, and all associated file names gathered.
Sub ProcessAttachments( iMsg as CDO.Message ) Dim iBp as CDO.IBodyPart Dim Filename as String Dim Atchmts as CDO.IBodyParts Set Atchmts = iMsg.Attachments ' Note here 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