Autor Beitrag
SatBL
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: Mo 06.09.04 21:38 
Hallo zusammen,
ich hoffe es kann mir jemand weiter helfen.

Ich arbeite an einem Projekt, bei dem ich verschiedene Sachen aus einem Active Directory auslesen möchte.
Der connect funktioniert auch und ich kann den Username, und Description auslesen. Nun möchte ich aber noch die eMAil-Adresse auslesen, und da tut es nicht mehr.
Ich bekomme da immer die Fehlermeldung: Habe Property nicht im Cache (oder so ähnlich), sitze gerade nicht vor meinem Prog.Rechner.

Hat jemand ein Bsp.Code mit den es funzt, danke schon mal im voraus.


Edit:

So sieht der Code aus.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
procedure TADSForm.Button1Click(Sender: TObject);
var Result:Integer;
    Obj: IADs;
    usr: IADsUser;
    ws1, ws2: Widestring;
begin
     Screen.Cursor := crHourglass;
     CoInitialize(nil);
     Result := ADsOpenObject('WinNT://'+Domain.Text,UserID.Text,Password.Text,1,IADs,Obj);
     Screen.Cursor := crDefault;

     if Succeeded(Result) then lbOK.Caption:='Login OK'
                          else lbOK.Caption:='Login Fehler';

     ADsGetObject('WinNT://' + Domain.Text + '/' + UserID.Text, IADsUser, usr); //OK

     ws1 := usr.FullName;
     Edit1.Text := ws1;

     ws2 := usr.EmailAddress;
     Edit2.Text := ws2;

     CoUninitialize;
end;


Die Meldung 'Die Verzeichniseigenschaft wurde nicht im Cache gefunden' kommt bei der Zuweisung: ws2 := usr.EmailAddress.

Kann es sein das die Eigenschaft im AD nicht freigegeben ist?


Gruß
Bernd

Moderiert von user profile iconMotzi: Code- durch Delphi-Tags ersetzt.
Gast
Gast
Erhaltene Danke: 1



BeitragVerfasst: Sa 02.10.04 17:23 
Tja, das passiert wenn man den falschen ADSI-Provider benutzt. WinNT:// kennt jede Menge Eigenschaften nicht, die es im LDAP:// gibt.

Zitat:
The Microsoft Windows NT ADSI provider implements a set of ADSI objects to support various ADSI interfaces. The namespace name for the Windows NT provider is "WinNT" and this provider is commonly referred to as the WinNT provider. To access the WinNT provider, bind to any of the ADSI objects of WinNT, using the WinNT AdsPath.


Zitat:
The Microsoft LDAP provider ADsPath requires the following format.
LDAP://HostName[:PortNumber][/DistinguishedName]
Note [ ] denotes optional parameters; it is not a literal part of the binding string.

The HostName can be a computer name, an IP address, or a domain name. A server name can also be specified in the binding string. Most LDAP providers follow a model that requires a server name to be specified.

The PortNumber specifies the specific port that should be used for the connection. If no port number is specified, the LDAP provider uses the default port number. The default port number is 389 if not using an SSL connection or 636 if using an SSL connection.

The DistinguishedName specifies the distinguished name of a specific object. A distinguished name for a given object is guaranteed to be unique.

The following table lists examples of binding strings.


Das Problem hatte ich auch, als ich ein Perl-Skript zur Benutzerverwaltung unserer 2K-Domain schrieb, daher wußte ich, wo ich suchen muß ;)