Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Active Directory User Names
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01669941
Message ID:
01669963
Vues:
48
>>>Hi,
>>>
>>>First, general AD question. Is each user name in the AD unique? That is, there is only one JOHN SMITH and next person with the same name would have to be somewhat different; e.g. JOHN SMITH2?
>>>
>>>Second question. Can you get ALL user names in the AD from a VFP 9 application? If yes, how?
>>>
>>>TIA
>>
>>For you second question this may help, it verifies the existence of a user, but you can easily change it to list all the users.
>>
>>
PROCEDURE verifyIfUserExists(tcUserID)
>>LOCAL lcUserId
>>lcUserId ='CN='+tcUserID
>>objRootLDAP = Getobject("LDAP://RootDSE")
>>strDNSDomain = objRootLDAP.Get("DefaultNamingContext") && Get the context
>>strGroup = "CN=oeb-test,"
>>strOU = "OU=Test,OU=OEB,OU=SAAS-users,"  && You correct specifications
>>*' Prepare the OU and the Group
>>objGroup = Getobject("LDAP://"+ strGroup + strOU + strDNSDomain)
>>objOU =Getobject("LDAP://" +strOU + strDNSDomain)
>>
>>For Each objUser In objOU
>>  If objUser.Class = Lower("User")
>>    IF objUser.name = lcUserId
>>      RETURN .T.
>>    ENDIF
>>  ENDIF
>>Endfor
>>RETURN .F.
>>
>>ENDPROC
>
>Mike,
>
>Thank you very much for the sample code. I will create a test and try it on a customer AD (I don't have one to test on my PC)

There are more functions I wrote here, if you need

http://www.atoutfox.org/articles.asp?ACTION=FCONSULTER&ID=0000000886
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform