Reading File Attachments
When reading messages with attachments, the attachment-related properties are used in much the same way as they are when sending messages with attachments. The difference, of course, is that you’re reading the properties rather than setting them. Before reading the attachment-related properties, first set the MsgIndex property to indicate which message to read, then read the AttachmentCount property to determine if the message has any attachments. If it does (i.e., if AttachmentCount is greater than 0), set the AttachmentIndex property to refer to a specific attachment. The AttachmentIndex property is a zero-based index that can range from to one less than the value contained in the AttachmentCount property. See Section 4.3.1, earlier in this chapter, for a more detailed discussion of how these properties work.
After setting the AttachmentIndex property, you’re ready to read the attachment information. All attachments are saved by the mail system as files in a temporary folder, regardless of whether the attachment is actually a binary file or an embedded OLE object. This is because embedded OLE objects are saved as files prior to being sent. As discussed earlier in this chapter, working with embedded OLE objects using the MAPI controls is exceedingly laborious, so it won’t be discussed further here. For a little detail on how it works, see Section 4.6, earlier in this chapter. This section considers only file attachments.
The full pathname of an attached ...