Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing email addresses in Outlook
Message
From
02/11/2004 06:53:52
 
 
To
01/11/2004 12:04:49
Stan Vaninger
Mitek Industries, Inc
Missouri, United States
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows NT
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00956609
Message ID:
00956932
Views:
15
Hi Stan.

I want to rerieve all the email addresses in one of the contact lists of our Outlook Address Book.

Below is some code to get the contacts from the address book into an array. What you do with the array is up to you < s >.
#define olFolderContacts 10
#define olContact        40
LOCAL loAddressBook AS Outlook.MAPIFolder, loContact AS Object, lnContactCount

*** Get a reference to the contacts folder
loOutlook = CREATEOBJECT( 'Outlook.Application' )
loNameSpace = loOutlook.GetNameSpace( 'MAPI' )
loAddressBook = loNameSpace.GetDefaultFolder( olFolderContacts )
IF VARTYPE( loAddressBook ) = 'O'
  lnContactCount = 0
  *** Get info about each contact into the array
  FOR EACH loContact IN loAddressBook.Items
    WITH loContact
      *** Make sure we only get individual contacts
      *** and skip any distribution lists
      IF .Class = olContact
	lnContactCount = lnContactCount + 1
	DIMENSION laContacts[ lnContactCount, 4 ]
	laContacts[ lnContactCount, 1 ] = .LastName
	laContacts[ lnContactCount, 2 ] = .FirstName
	laContacts[ lnContactCount, 3 ] = .Email1Address
	laContacts[ lnContactCount, 4 ] = .FullName
      ENDIF
    ENDWITH
  ENDFOR
  ASORT( This.aContacts )
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform