Python and Active Directory

Mark Hammond mhammond at skippinet.com.au
Fri Mar 10 10:54:42 CET 2000


"Augustine David" <augustine_david at yahoo.com> wrote in message
news:t8Yx4.1012$Qf.532452 at news-west.usenetserver.com...
> -----BEGIN PGP SIGNED MESSAGE-----

> I am attempting to reproduce the SDK examples below in Python.  I
have ran
> "makepy" on the type library,
> but I am unsure how to call any of its classes using
> "win32com.client.Dispatch".  Any input you can give me
> would be appreciated.

This is a little painful unfortunately.  Note the second line - this
is necessary to force the constant ADS_SECURE_AUTHENTICATION into the
COM constants namespace.   This second line was generated by running
"makepy.py -i".  Otherwise you could just use the literal constant 1
:-)  Normally the constants are "magically" loaded by the time you
need them, but not in this case.

This requires build 128 of win32all.  Also I cant make it work, but I
think I simply can't get the strings correct (Ive struggled with this
before :-(

-- activeds.py
from win32com.client import gencache, GetObject, constants
gencache.EnsureModule('{97d25db0-0363-11cf-abc4-02608c9e7553}', 0, 1,
0)

np = GetObject("LDAP:")
user=np.OpenDSObject(LDAP://CN=...,
                     "", "",
                     constants.ADS_SECURE_AUTHENTICATION)
-- eof

Mark.





More information about the Python-list mailing list