Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

outlook email automation in visual foxpro 6.0 apps

1 view
Skip to first unread message

Jacko

unread,
Sep 18, 2001, 11:23:54 AM9/18/01
to
Is there anyone out there who can help me out on email
automation with outlook 2000 in visual foxpro 6.0
applications. Please post links and/or codes. Thank you.

John Spiegel

unread,
Sep 18, 2001, 12:00:56 PM9/18/01
to
Hey Jacko,

There's an e-mail example in the VFP samples and also the book on Automation
with VFP by Granor available at Hentzenwerke.com is a nice reference--it
won't tell you everything but gives a good set of examples and getting your
feet wet. While you can't record macros and read the code as in Word and
Excel, the Outlook help does cover VB usage under "Advanced Customization".
You'd need to "FoxPro-ize" the syntax, but the examples are close and the
objects are documented.

I'm far from a master, but the following example opens Outlook, creates the
necessary Outlook objects then spins through a table of e-mails,
manipulating the body of the e-mail, and other components then sends it out.

Hope it helps,

John

#DEFINE oFolderDisplayNormal 0
oOutlook = CreateObject("Outlook.Application")
oNameSpace = oOutlook.GetNameSpace("MAPI")
oExplorer = oOutlook.Explorers.Add( oNameSpace.Folders[1],
oFolderDisplayNormal )

* The NameSpace effectively provides a gateway to Outlook's objects. It's
pretty much required
* and implies that the getnamespace will be needed pretty much any time
we're automating Outlook.

* MyTable ( EMailAddress C (100), MessageText M, Attachment C (100) )

SELECT MyTable
SCAN
oMailItem = oOutlook.CreateItem( 0 ) && The MailItem constant as opposed
to a task, etc.

WITH oMailItem
.Subject = RptQuery
.Body = MyTable.MessageText

.Body = .Body + CHR( 13 ) + "This message was automation-created
with VFP!"

.Recipients.Add( ALLTRIM( MyTable.EMailAddress ) )
LastRecipient = .Recipients.Add( ALLTRIM( "m...@mycompany.com" ) )
LastRecipient.Type = 2 && Carbon Copy
.Attachments.Add( FULLPATH( ALLTRIM( MyTable.Attacment ) ) )
.Send()
ENDWITH
ENDSCAN

oOutlook.Quit()
RELEASE oOutlook


"Jacko" <som...@somewhere.com> wrote in message
news:17c101c14055$ed46c300$a5e62ecf@tkmsftngxa07...

Rick Bean

unread,
Sep 18, 2001, 4:30:04 PM9/18/01
to
Jacko,
John Harvey also has some sample code at
http://home.att.net/~john.harvey/vfpstuff.htm.

Rick

"Jacko" <som...@somewhere.com> wrote in message
news:17c101c14055$ed46c300$a5e62ecf@tkmsftngxa07...

Jacko

unread,
Sep 19, 2001, 1:36:41 PM9/19/01
to
Thank you.

>.
>

0 new messages