Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Email Address Books
Message
From
07/03/2013 14:04:50
 
 
To
07/03/2013 12:52:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01567774
Message ID:
01567784
Views:
70
This message has been marked as a message which has helped to the initial question of the thread.
>Has anyone written any good programs to extract names and email addresses from outlook express, outlook, thunderbird, etc. address books so they may be used in a VFP program?

I'm pretty sure we have code for Outlook in the Office Automation book. Here you go:
* Read Outlook contact information into a cursor

#DEFINE olContacts 10
#DEFINE olNone 0
#DEFINE olHome 1
#DEFINE olBusiness 2
#DEFINE olOther 3

LOCAL oNameSpace, oContacts, oContact

LOCAL cFirst, cLast, cAddr, cPhone

IF VarType(oOutlook) <> "O"

  * Start or connect to Outlook
  * Make it public for demonstration purposes.
  RELEASE oOutlook
  PUBLIC oOutlook
  oOutlook = CreateObject("Outlook.Application")

ENDIF

oNameSpace = oOutlook.GetNameSpace("MAPI")

* Get Contacts folder
oContacts = oNameSpace.GetDefaultFolder( olContacts )

* Create a cursor to hold contact information
CREATE CURSOR ContactInfo ;
  (cFirstName C(15), cLastName C(20), mAddress M, cPhoneNum C(30))

* Go through contacts
FOR EACH oContact IN oContacts.Items
  WITH oContact
    cFirst = .FirstName
    cLast = .LastName
    cPhone = .PrimaryTelephoneNumber 

    * Choose the right address. If the primary phone number is empty,
    * pick up the phone number associated with this address.
    DO CASE
    CASE .SelectedMailingAddress = olHome
      cAddr = .HomeAddress
      IF EMPTY(cPhone)
        cPhone = .HomeTelephoneNumber
      ENDIF
  
    CASE .SelectedMailingAddress = olBusiness
      cAddr = .BusinessAddress
      IF EMPTY(cPhone)
        cPhone = .BusinessTelephoneNumber
      ENDIF

    CASE .SelectedMailingAddress = olOther
      cAddr = .OtherAddress
      IF EMPTY(cPhone)
        cPhone = .OtherTelephoneNumber
      ENDIF

    CASE .SelectedMailingAddress = olNone
      cAddr = ""
    ENDCASE

    INSERT INTO ContactInfo VALUES (cFirst, cLast, cAddr, cPhone)
  ENDWITH
ENDFOR

* Show the results
BROWSE

RETURN
Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform