DOCUMENT:Q186148 26-MAY-1998 [vbwin] TITLE :PRB: Error 32002 Working with Attachments in MAPI Controls PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:4.0,5.0 OPER/SYS:WINDOWS KEYWORDS: ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Standard and Enterprise Editions for Windows, versions 4.0, 5.0 --------------------------------------------------------------------- SYMPTOMS ======== The following error may occur when trying to send a message with multiple attachments: Error 32002: Unspecified Failure However, the message sends successfully if there is only one attachment. CAUSE ===== If the AttachmentPosition property is not set for each attachment, it will default to 0. Therefore, any attachments beyond the first are overwriting the Position data for the prior attachment and thereby invalidating all but the last attachment added. RESOLUTION ========== Designate a unique AttachmentPosition for each attachment in the message as demonstrated in this Visual Basic code sample: Sub Main() 'Logon & Sync MAPISession1.SignOn 'Create Message w/Attachments then Send With MAPIMessages1 .SessionID = MAPISession1.SessionID .Compose .MsgSubject = "OCX - Test Message" .RecipDisplayName = "YourRecipientNameHere" .ResolveName 'The value 2 is passed to the Space() function in the 'next line because there are two attachments to add. 'These spaces act as placeholders for the attachments. .MsgNoteText = _ Space(2) & vbCrLf & _ "This message was sent from the MSMAPI32.OCX." & vbCrLf & _ "This message contains 2 attachments." 'Replace the AttachmentPathName values below as applicable... .AttachmentIndex = 0 .AttachmentPosition = 0 .AttachmentPathName = ("c:\test1.txt") .AttachmentIndex = 1 .AttachmentPosition = 1 .AttachmentPathName = ("c:\test2.txt") .Send End With MAPISession1.SignOff End Sub MORE INFORMATION ================ To reproduce this issue, comment the two lines in the code sample above that set the AttachmentPosition value for each attachment. Additional query words: kbDSupport kbMsg kbCtrl kbMAPI kbvbp400 kbvbp500 ====================================================================== Version : WINDOWS:4.0,5.0 Platform : WINDOWS Issue type : kbprb ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1998.