Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with MAPI 1

Status
Not open for further replies.

DarrenWard

IS-IT--Management
Feb 15, 2002
217
GB
mapiSession.logonUI = .t.
mapiSession.signOn
mapiMessage.sessionID = mapiSession.sessionID
mapiMessage.msgindex = -1
mapiMessage.msgnoteText = "Hello "
mapiMessage.attachmentIndex = 0
mapiMessage.attachmentPathName = 'C:'
mapiMessage.attachmentName = 'Scan.Tiff'
mapiMessage.attachmentPosition = 0
mapiMessage.attachmentType = 0
mapiMessage.Action = 2
mapiMessage.signOff

I get an OLE execption : Failure on opening attachment

The file definately exists and if I use the exact same code in VB6 is works.

I have both controls on the form, any ideas?

Dazz

GuiltyMaggot - The best rock band in the world!
 
DarrenWard

Maybe the faq184-1769 might help you figure out what is going on. It could be an attachment index problem.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Try putting the file name in the pathname entry and using double quote marks" ".
i.e. mapiMessage.attachmentPathName = "C:\Scan.Tiff"

Let me know if you get it.

Pat

 
Whether you use single quotes or double quotes is irrelevant; however, culleoka is correct that you will need to set the AttachmentPathName property to include the absolute file path.

FYI, the AttachmentName property is simply the way the recipient will see the attachment.

Also, the SignOff method is a member of the MapiSession object, not MapiMessage. Thus if you directly port the above code to VB6 and only correct the syntactical differences, it will fail with a "Method of data member not found" upon compilation. Even after correcting that, at runtime, you will get the exact error as above, due to the lack of absolute file path to the attachment.

Jon Hawkins
 
Jon, yeah I knew the SignOff, the code posted was pseudo code and not cut from my app, a lesson learned maybe.

I have given the AttachmentPathName the full path and filename and it now works, I had the code working in VB6 but was passing it file and path name so did not pick up the error.

Thanks all

GuiltyMaggot - The best rock band in the world!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top