Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sucking eMail out of Outlook Express
Message
From
28/10/2003 18:56:45
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, United Kingdom
 
 
To
28/10/2003 18:42:38
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00843867
Message ID:
00843874
Views:
19
Hi Michel,

As Fred said, I have Outlook Express, not Outlook. I have avoided upgrading because I use this info daily and didn't want to risk any problems.

If there's no quick and dirty method for Outlook Express, then I may have to bite the bullet and upgrade.

Thanks.


>>I'm looking to interact with Outlook Express, probably via MSMAPI and VFP.
>>
>>There are lots of FAQ's about sending messages, but that's not what I need to do.
>>
>>I have various folders in OE with 50,000 plus messages that I regularly search through for information.
>>
>>I want to export all of this email from OE into a VFP database, which I can then manipulate to slice & dice this info as necessary.
>>
>>This doesn't even need to be an automated job as I am writing another VFP app to collect further info directly from the POP3 server.
>
>Here's some code that you can start with:
>
>
>LOCAL loOutlook,loNS,loInbox,loMailItems,lnCompteur,lnCount,lnCompteur2,lcAddress,llOk
>loOutlook=CREATEOBJECT('Outlook.Application')
>loNS=loOutlook.GetNameSpace('MAPI')
>loInbox=loNS.Folders('Personal Folders').Folders('Spam')
>loMailItems=loInbox.Items
>CLOSE ALL
>USE Email
>lnCount=loMailItems.Count
>lnCompteur2=0
>FOR lnCompteur=lnCount TO 1 STEP -1
>   lnCompteur2=lnCompteur2+1
>   WAIT WINDOW ALLTRIM(STR(lnCompteur2))+' of '+ALLTRIM(STR(lnCount)) NOWAIT
>   loItem=loMailItems.Item(lnCompteur)
>   APPEND BLANK
>   REPLACE AddDate WITH loItem.CreationTime
>   REPLACE Sender WITH loItem.SenderName
>   REPLACE Subject WITH loItem.Subject
>   IF LEN(ALLTRIM(loItem.Body))>0
>      REPLACE Notes WITH loItem.Body
>      ELSE
>      REPLACE Notes WITH loItem.HTMLBody
>   ENDIF
>   REPLACE To WITH loItem.To
>
>   * Sender email
>   lcAddress=''
>   IF '@'$Sender
>      lcAddress=Sender
>      ELSE
>      loReply=loItem.Reply()
>      llOk=.F.
>
>      * First, lets try to get it from this method
>      IF TYPE('loReply.Recipients.Item(1)')='O'
>         IF '@'$loReply.Recipients.Item(1).Address
>            lcAddress=loReply.Recipients.Item(1).Address
>            llOk=.T.
>         ENDIF
>      ENDIF
>
>      * If the first method failed
>      IF NOT llOk
>         IF TYPE('loReply.Recipients[1]')='O'
>            loRecipient=loReply.Recipients[1]
>            IF NOT EMPTY(loRecipient.Address)
>               IF '@'$loRecipient.Address
>                  lcAddress=loRecipient.Address
>                  ELSE
>                  IF '@'$loRecipient.Name
>	            lcAddress=loRecipient.Name
>                  ENDIF
>	      ENDIF
>	      ELSE
>	      IF '@'$loRecipient.Name
>	         lcAddress=loRecipient.Name
>	      ENDIF
>	   ENDIF
>	ENDIF
>      ENDIF
>
>   ENDIF
>
>   REPLACE Address WITH LOWER(lcAddress)
>
>   IF TYPE('loItem.Recipients.Item(1)')='O'
>      REPLACE ToAddress WITH LOWER(loItem.Recipients.Item(1).Address)
>   ENDIF
>NEXT
>WAIT CLEAR
>BROWSE
>CLOSE ALL
>
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform