Information générale
Catégorie:
Fonctions Windows API
>Tamar
>
>Sometimes an address can be entered incomplete, is there a way of obtaining the FULL address name from the Outlook api when only entering a minimal length address?
>
>Thanks
>Kev
First, realize that Outlook is really smart about this stuff. If it can figure out who you mean from the fragment, it'll do so. That appears to be true, even for a partial email address.
OTOH, if Resolve returns .F., you could do a manual search through the Contacts folder to look for a match. But, if Resolve couldn't resolve the string, that means it's ambiguous. The one thing that I'm not sure whether Resolve handles is matching e-mail addresses that aren't the primary e-mail, so looping through Contacts would be helpful there.
In addition, if you just want to look up a person or an e-mail address, you can do it by going through the Contacts folder. This example is based on one of the examples in the book Della Martin and I wrote about automating Office:
#DEFINE olContacts 10
oOutlook = CreateObject("Outlook.Application")
oNameSpace = oOutlook.GetNameSpace("MAPI")
* Get Contacts folder
oContacts = oNameSpace.GetDefaultFolder( olContacts )
lFound = .F.
FOR EACH oContact IN oContacts.Items
WITH oContact
IF .LastFirstSpaceOnly = cYourString
* Found it
lFound = .T.
EXIT
ELSE
IF .Email1Address = cYourString
* Found it
lFound = .T.
EXIT
ELSE
IF .Email2Address = cYourString
* Found it
lFound = .T.
EXIT
ELSE
IF .Email3Address = cYourString
* Found it
lFound = .T.
EXIT
ENDIF
ENDIF
ENDIF
ENDWITH
ENDFOR
IF lFound
* Do whatever
ENDIF
Tamar
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement