Thread: FoxPro Some General Questions/Import Outlook phone book

Import Outlook phone book
CREATE CURSOR emaillist ;
(Firstname C(30), Lastname C(30), email C(30))


#define olFolderContacts 10

outlook = CreateObject("Outlook.Application")
namesp = outlook.GetNamespace("MAPI")
folder = namesp.GetDefaultFolder(olFolderContacts)
contacts = folder.Items
cnt = contacts.Count

SELECT 0
SELECT emaillist

For i = 1 To cnt
   contact = contacts.Item(i)

   IF contact.FirstName = ' ' OR contact.LastName = ' ' OR contact-.Email1Address = ' '
* do nothing
   ELSE
      APPEND BLANK
      REPLACE Firstname WITH contact.FirstName
      REPLACE Lastname WITH contact.LastName
      REPLACE email WITH contact.Email1Address
   ENDIF
Next i

BROWSE TITLE 'Contact list'
outlook.Quit()