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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing Email... 1

Status
Not open for further replies.

Barnyard

Programmer
Apr 2, 2003
12
US
Does someone know how I can extract the body of an email in my Outlook Inbox using VFP?
 
Gotta admit I don't know of any way to do this.

I do know that on exchange server you can trigger scripts to run on event occurance.. I would try to create a server script that saves the body to a pre defined file name , and then have my FoxPro app look for the existance of that file.

Hopefully one of the Guru's here can help you. Kinda Curious about it myself now. LCB

Puritanism - the secret fear that someone, somewhere is having fun.
 
Hi my friend
You can use this code to do this.
Code:
*// Creat object for OutLook application (Start)
myOlApp = CreateObject("Outlook.Application")
myNameSpace = myOlApp.GetNameSpace("MAPI")
*// Creat object for OutLook application (End  )

*// Locate your InBox folder as an object.(Start)
myFolder=myNameSpace.GetDefaultFolder(6)
*// Locate your InBox folder as an object.(End  )

*// Locate a Specific message.(Start) 
FOR I= 1 to Myfolder.Items.Count
  * You have to set you own selection criteria, for example
  * I am locating a message from me with a certain subject.
  IF Myfolder.Items(I).SenderName="Walid Magd" AND ;
         Myfolder.Items(I).Subject="TEST OUTLOOK"
    OMyMessage=Myfolder.Items(I)
    EXIT
  ENDIF
ENDFOR
*// Locate a Specific message.(End  ) 
*// Store the message body in variable(Start)
lcMessageBody = OMyMessage.Body
*// Store the message body in variable(End  )
*// Do whatever you want with the returned string
? lcMessageBody
Walid Magd
Engwam@Hotmail.com
 
Please make sure that your search returned a message before attempting to assign the body to a variable, otherwise you will have a run time error
Code:
IF TYPE("OMyMessage")= "O"
  *// Store the message body in variable(Start)
  lcMessageBody = OMyMessage.Body
  *// Store the message body in variable(End  )
ENDIF
Thanks Walid Magd
Engwam@Hotmail.com
 
Walid,

Very good! Our local FoxPro group has been working on Outlook the last couple of meetings and came up with essentially the same code (no surprise there). Barnyard may be interested in looking more at outlook. The helpfile for VBA for Outlook 2000 is:

"C:\Program Files\Microsoft Office\Office\1033\VBAOUTL9.CHM" on my system.

Our group is intending to create a wrapper class in FoxPro for Outlook, but we're not done with it yet. There's a lot of functionality to code for!

Dave Dardinger
 
Hi Dave
Where is your local Fox group located? can I participate in this calss developing?
Thanks Walid Magd
Engwam@Hotmail.com
 
Cool...

Have written code to send mail many times... never had to read it. Now I know ! Learn something new every day. LCB

Puritanism - the secret fear that someone, somewhere is having fun.
 
Walid,

It's the El Zorro group in Phoenix, AZ. I believe the website is elzorro.org, but I'm not certain. --Dave
 
Does any of this change in outlook 2002??

thank, Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top