Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dir comm for Outlook Express
Message
De
24/05/2003 13:55:24
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00791744
Message ID:
00792565
Vues:
23
>How can I get a directory or subdirectory for messages in my InBox in Outlook Express?
>Then, what command do I use to copy some of them so that they appear as text
>files in a folder outside of Outlook Express.

Here's something that will get all folders in Inbox, will create a directory under D:\ for each Inbox sub folder's name and will create one record in a cursor will everything you need.
CREATE CURSOR Temp (AddDate T,Sender C(40),Subject C(100),Notes M,To C(40),Address C(40),ToAddress C(40))
LOCAL loOutlook,loNS,loInbox,lnFolder,loInboxItems,lnCount,lnCompteur,loEmail
LOCAL lcAddress,loReply,llOk
loOutlook=CREATEOBJECT('Outlook.Application')
loNS=loOutlook.GetNameSpace('MAPI')
loInbox=loNS.GetDefaultFolder(6)
FOR EACH loFolder IN loInbox.Folders
   lcFolderName=loFolder.Name
   IF NOT DIRECTORY('d:\'+lcFolderName)
      MD 'd:\'+lcFolderName
   ENDIF
   loInboxItems=loFolder.Items
   lnCount=loInboxItems.Count
   FOR lnCompteur=1 TO lnCount
      APPEND BLANK
      loEmail=loInboxItems.Item(lnCompteur)
      REPLACE AddDate WITH loEmail.CreationTime
      REPLACE Sender WITH loEmail.SenderName
      REPLACE Subject WITH loEmail.Subject
      IF LEN(ALLTRIM(loEmail.Body))>0
         REPLACE Notes WITH loEmail.Body
         ELSE
         REPLACE Notes WITH loEmail.HTMLBody
      ENDIF
      REPLACE To WITH loEmail.To

      * Sender email
      lcAddress=''
      IF '@'$Sender
         lcAddress=Sender
         ELSE
         loReply=loEmail.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('loEmail.Recipients.Item(1)')='O'
         REPLACE ToAddress WITH LOWER(loEmail.Recipients.Item(1).Address)
      ENDIF
   NEXT
NEXT
BROWSE
You may then adjust the directory path and change the cursor approach to dump all that in a file.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform