Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get the full user's name of the PC
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01406221
Message ID:
01406702
Vues:
72
>>It's a computer in the network, but I don't know what we're using here.
>
>As trying is easy, we can assume you are in a domain and using LDAP, so you can try this code, note that this is an old test I've done long time ago and never used it other than for testing, so there is no error checking
>
>
>#define	ADS_NAME_INITTYPE_GC	3
>#define	ADS_NAME_TYPE_1779		1
>#define	ADS_NAME_TYPE_NT4		3
>clear
>
>loUser			= GetObject("LDAP://" + getDistinguishedName(Getenv("USERNAME")))
>? loUser.CN
>
>Function getDistinguishedName(tcSAMAccountName, tcDomain)
>	local loNameTranslate, lcDistinguishedName, lcDomain
> 
> 	lcDomain			= Iif(Vartype(tcDomain) = 'C' and not Empty(tcDomain), tcDomain, Getenv("USERDOMAIN"))
>	loNameTranslate			= CreateObject("NameTranslate", ADS_NAME_INITTYPE_GC, "")
> 	loNameTranslate.Set(ADS_NAME_TYPE_NT4, lcDomain + "\" + tcSAMAccountName)
>	lcDistinguishedName		= loNameTranslate.Get(ADS_NAME_TYPE_1779)
>	return lcDistinguishedName
>endfunc
>
>
Sorry, got

Program Error
Cancel
Suspend
Ignore
Help
OLE error code 0x8007054b: The specified domain either does not exist or could not be contacted.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform