Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Microsoft Outlook 2000
Message
De
17/03/2004 10:32:57
 
 
À
17/03/2004 07:24:21
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00887015
Message ID:
00887081
Vues:
10
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform