Multiple e-mail attachments cause error with MSMAPI OCX control that is included in Visual FoxPro (181899)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
- Microsoft Visual FoxPro for Windows 7.0
- Microsoft Visual FoxPro 8.0
- Microsoft Visual FoxPro 9.0 Professional Edition
This article was previously published under Q181899 SYMPTOMS
When you attach multiple file attachments by using the MSMAPI32 OCX and you call
the Send method, you receive the following error message:
OLE IDispatch exception code 0 from MAPIMessages: Unspecified Failure
has occurred.
CAUSE
The AttachmentPosition property of the MAPIMessage control is not being
incremented with each attachment. The AttachmentPosition property indicates
the position of the attachment within the message. If two attachments
occupy the same position, an error occurs when the MAPIMessage's Send
method is called.
RESOLUTION
Change the AttachmentPosition for each attachment. In the code sample
below, change the following section:
*-- Attach the files.
FOR lnCount = 1 TO ALEN(lcAttachment)
oMessage.AttachmentIndex = lnCount - 1
oMessage.AttachmentPathName = lcAttachment(lnCount)
ENDFOR
The changes for the code are give below:
*-- Attach the files.
FOR lnCount = 1 TO ALEN(lcAttachment)
oMessage.AttachmentIndex = lnCount - 1
oMessage.AttachmentPathName = lcAttachment(lnCount)
*-- We have to increment the AttachmentPosition because two
*-- attachments cannot occupy the same space.
*-- The AttachmentPosition dictates the character position of the
*-- attachment, so stick them in after the message.
oMessage.AttachmentPosition = lnCount - 1
ENDFOR
STATUS
This behavior is by design.REFERENCES
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
136638
How to send e-mail programmatically by using MSMAPI OLE control
COMCTL1.HLP Help; Topic: "AttachmentPosition Property"
Modification Type: | Major | Last Reviewed: | 1/27/2005 |
---|
Keywords: | kbprb KB181899 kbAudDeveloper |
---|
|