PRB: Multiple E-mail Attachments Cause Error with MSMAPI OCXLast reviewed: March 2, 1998Article ID: Q181899 |
The information in this article applies to:
SYMPTOMSWhen attaching multiple file attachments using the MSMAPI32 OCX, calling the Send method causes the following error to occur:
OLE IDispatch exception code 0 from MAPIMessages: Unspecified Failure has occurred. CAUSEThe 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.
RESOLUTIONChange 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) ENDFORThe 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 STATUSThis behavior is by design.
MORE INFORMATIONNOTE: This code works with version 6.00.8023 of the Msmapi32.ocx control. If an earlier version of this control is installed, an error occurs when setting the LogonUI property. The Msmapi.ocx version 1.0.2815 ships with Visual FoxPro version 5.0. This code runs under Visual FoxPro 5.0; however, the later version of the MSMAPI32 control must be installed and registered. The AttachmentPosition property determines the character position of an attachment within a message. This value can be programmatically set to any position within the message body. However, since the number of attachments may be unknown, it would be easiest to increment the AttachmentPosition property one character for each attachment.
Steps to Reproduce Behavior
REFERENCESFor additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q136638 TITLE : How To Send Email Programmatically by Using MSMAPI OLE ControlCOMCTL1.HLP Help; Topic: "AttachmentPosition Property"
|
Additional query words: MSMAPI MAPI OCX
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |