[python-win32] Problems using ADSI from Python (need IDirectorySearch Interface)

Roach, Mark R. mrroach@uhg.net
22 Apr 2002 08:58:18 -0500


On Mon, 2002-04-22 at 08:34, Ulrich Eck wrote:
> another thing that makes me dizzy: the pythoncom reference (shipped with
> active-python) tells about IADsUser,IADsContainer, IDirectoryObject in
> chapter modules .. but i cannot import any of these ?!?


(I am no expert on this, but) As far as I know, these classes can only
be accessed via certain function calls to the externally accessible
objects. For example to get an IADsUser

usrAcct = win32com.client.GetObject("WinNT://" + domain + "/" + username + ",user")

or if it is a new user

dom = win32com.client.GetObject("WinNT://" + domain)
usr = dom.Create("user", username)

similarly for IADsContainer

ldapNameSpace = adsiNameSpaces.getobject("", "LDAP:")
Cont = ldapNameSpace.OpenDSObject(ADsPath, AdminUser, AdminPass, 0)


I hope that helps,

Mark Roach