Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
The FileName property corresponds to the filename parameter attribute used with the Content-Disposition 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 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 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. We could use these names to render attachment bitmaps in a UA, save it into a file with this name, or make a guess as to its type if, for example, the attachment simply had Content-Type equal to "application/octet-stream."
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 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