Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use msmapi
Message
 
 
To
15/12/1998 09:56:48
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00167670
Message ID:
00167858
Views:
25
Chris,

Here's some code I use to attach files to an email:
with this.oleMAPIMessages
   this.mnAttachmentCount = this.mnAttachmentCount + 1
   dimension this.maAttachments[this.mnAttachmentCount]
   .AttachmentIndex = this.mnAttachmentCount - 1
   .AttachmentPathName = pcFileName
   i = rat( "\", pcFileName )
   this.maAttachments[this.mnAttachmentCount] = substr( pcFileName, i+1 )
   .AttachmentName = this.maAttachments[this.mnAttachmentCount]
   .AttachmentType = 0
endwith
There's a slight difference between AttachmentPathName and AttachmentName that what you are doing.

>I am trying with limited success to initiate sending of a report via email. I'm using VFP 5.0. I can get a simple message to go, but not a message with an attachment. Mapisession is named olecontrol2 and mapimessage is named olecontrol1 in my code:
>
>ThisForm.Olecontrol2.downloadmail = .f.
>ThisForm.Olecontrol2.signon
>thisform.logsession = .t.
>local lnx
>lnx = rat("\", thisform.cPrintFileName)
>with thisform.Olecontrol1
> .sessionid = ThisForm.Olecontrol2.sessionid
> .compose
> .attachmentindex = 1
> .attachmentpathname = left(thisform.cPrintFileName, lnx) .attachmentname = subsr(thisform.cPrintFileName, lnx + 1)
> .msgnotetext = "Attached is a copy of ";
> + thisform.cHeading.caption
> .msgsubject = thisform.cHeading.caption
> .send(1)
>endwith
>ThisForm.Olecontrol2.signoff
>
>It generates an error saying it can't find the attachment. But attachmentpathname and attachmentname are correct. I've never used this before, so hopefully there is something obviously wrong. The documentation doesn't help me much. Is there a good book on the topic? Also, how can I name mapisession and mapimessage controls to something more meaningful (I can't do it in the form designer).
>
>Thanks.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform