Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MAPI Routine Works with Windows Messaging, Not with Outl
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00586701
Message ID:
00597776
Views:
33
OK (with extracts from the help file):-

Compose a new message sets the message id to -1.
Put a space or somesuch in the message body.

To add a new attachment, set the AttachmentIndex to a value greater than or equal to the current attachment count while in the compose buffer (
MsgIndex = -1). The AttachmentCount property is updated automatically to reflect the implied new number of attachments.
For example, if the current AttachmentCount property has the value 3, setting the AttachmentIndex property to 4 adds 2 new attachments and increases the AttachmentCount property to 5.
(I use attachmentIndex = attachmentCount+1)

To determine where an attachment is placed, count the characters in the message body and decide which character position you wish to replace with the attachment. The character count at that position should be used for the AttachmentPosition value.
For example, in a message body that is five-characters long, you could place an attachment at the end of the message by setting AttachmentPosition equal to 4. (The message body occupies character positions 0 to 4.)

You can't place two attachments in the same position within the same message. In addition, you can't place an attachment beyond the end of the message body.
The value of AttachmentPosition depends on the currently indexed attachment, as selected by the AttachmentIndex property.

For attachmentPathName, you must use the full path. If you attempt to send a message with an empty string for a path name, an error results.

What was the original error code? The MAPI96.HLP file has a number of possible errors:-

mapAttachmentNotFound 32011
Attachment not found
The specified attachment wasn't found, and mail wasn't sent.

mapAttachmentOpenFailure 32012
Failure on opening attachment
The attachment couldn't be located. Mail wasn't sent. Verify that the AttachmentPathName property is valid.

mapAttachmentWriteFailure 32013
Failure attempting to write an attachment
An attachment could not be written to a temporary file. Check directory permissions.

mapTooManyFiles 32009
Too many files
Too many file attachments are contained in the message. The mail wasn't sent or read.

>Iain and Robert:
>
>I tried it with...
>
>AttachmentIndex = -1
>AttachmentPosition = -1
>
>and got...
>
>Program Error
>OLE IDispatch exception code 0 from MAPIMessages: Invalid property value.
>
>I also tried it with...
>
>AttachmentIndex = 1
>AttachmentPosition = 1
>
>and got...
>
>Program Error
>OLE IDispatch exception code 0 from MAPIMessages: Attachment not found.
>
>
>>Chuck,
>>
>>I can recall many moons ago, that MS confirmed a bug in out look. The way around it was to use -1 for the attachments. I do not know if the have fixed this since I last done any work with outlook, but it is another input to help all.
Previous
Reply
Map
View

Click here to load this message in the networking platform