Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Microsoft Outlook 2000
Message
From
17/03/2004 10:32:57
 
 
To
17/03/2004 07:24:21
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00887015
Message ID:
00887081
Views:
9
in my vfp6 application, i want to present the user with an option (like a checkbox object) which when clicked (checked) displays the list of contacts that are available in the address book of microsoft outlook 2000 software which is loaded on the user's machine and if the user selects any particular contact's name, i want to pick up that contact's e-mail address from microsoft outlook 2000 and place it on a textbox in my form.

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
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