Microsoft KB Archive/186148

= PRB: Error 32002 Working with Attachments in MAPI Controls =

Article ID: 186148

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Enterprise Edition

-



This article was previously published under Q186148



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

Keywords: kbprb KB186148

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.