i want to create a new active directory schema property. for testing,
i use the following simpy function:
Expand|Select|Wrap|Line Numbers
- public void createProperty()
- {
- string cn = "leo8";
- DirectoryContext dc = new
- DirectoryContext(DirectoryContextType.DirectoryServer, serverIP,
- userName, password);
- ActiveDirectorySchemaProperty prop = new
- ActiveDirectorySchemaProperty(dc, cn);
- Guid g = new Guid();
- prop.CommonName = cn;
- prop.Description = "blabla";
- prop.IsDefunct = false;
- prop.IsIndexed = false;
- prop.IsIndexedOverContainer = false;
- prop.IsInGlobalCatalog = true;
- prop.IsSingleValued = true;
- prop.Oid = "1.3.6.1.4.1.28070.9.1.3.45";
- prop.Syntax = ActiveDirectorySyntax.CaseIgnoreString;
- prop.SchemaGuid = g = Guid.NewGuid();
- prop.Save();
- }
the function works fine, but i get some exceptions!
at first and second time, the
System.Director yServices.Activ eDirectory.Acti veDirectoryObje ctNotFoundExcep tion
(translated from german) the directoryServer
'illertec-6hvyin.testdoma in.lan' is not avaible or can not contact,
and then a
System.Director yServices.Activ eDirectory.Acti veDirectoryObje ctExistsExcepti on
(translate from german) object allready exists.
i am looking in the schema, and i find that the new property was
created at the first call from the prop.save() function.
i understand why the .ActiveDirector yObjectExistsEx ception is called,
but i do not understand why the
ActiveDirectory ObjectNotFoundE xception is called, when the property is
created.
thanks for comments
zimmys
some informations:
the domaincontroler that is called, is runnig on a virtual machine(for
test purposes), and is not the domaincontroler for my real domain
where my devolopment environment runs.
the dc is an server2003 r2 and i my machine runs under vista with
visual studio 2005.