Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Outlook
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01555671
Message ID:
01555724
Vues:
51
Thanks Hugo.



>>Hi All,
>>
>>How can I use COM automation to get the users primary email address from his Outlook application? Thanks.
>
>I wrote this code long time ago, but I think I replaced for something else later, but I forgot... Anyways, as you are asking for Outlook... it needs redemption in order to avoid the security check from Outlook, if you are using other way to by pass it (like YesNo) then you can remove the redemption related code.
>
>
>
>? getSenderEMail(GetEnv("USERNAME"))
>
>function getSenderEMail(tcSender as String) as Object
>	local loOF, loMailItem, loOutlook, loItem, lcEMailAddress, loException, lcLastError
>	
>	loMailItem	= CreateObject("Redemption.SafeMailItem")
>	loOutlook	= Createobject('Outlook.Application')
>	loItem		= loOutlook.CreateItem(0)
>	loMailItem.Item	= loItem
>	lcEMailAddress	= ''
>	try
>		loMailItem.Recipients.Add(tcSender)
>		if loMailItem.Recipients(1).Resolve()
>			with loMailItem.Recipients(1).AddressEntry
>				lcEMailAddress	= .Name + ' <' + .SMTPAddress + '>'
>			endwith
>		else
>			* Unable to resolve
>		endif
>	catch to loException
>		lcLastError	= Proper(This.Class) + " has encountered a problem." + Chr(13) ;
>						+ "Error Number: " + Transform(loException.ErrorNo) + Chr(13) ;
>						+ "Module: " + 'getSenderInfo' + Chr(13) ;
>						+ "Line: " + Alltrim(Str(loException.LineNo)) + Chr(13) ;
>						+ "Description: " + laError[2]
>
>		MessageBox(lcLastError)
>	endtry
>	return lcEMailAddress
>endfunc
>
>
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform