c# - Add none UserPrincipal field to AD entry -


i trying add none userprincipal field small application, cannot work. tried several ways simple task, cannot work me. trying add field called company inserted active directory, company not field can inserted...

any ideas? please post code example if have one. have far:

public bool createnewuser(string susername, string spassword, string sgivenname, string ssurname, string email, string phone)     {         if (!isuserexisting(susername))         {              string sou = "ou=users,ou=external,dc=external,dc=rootteck,dc=com";              principalcontext oprincipalcontext = getprincipalcontext(sou);              userprincipal ouserprincipal = new userprincipal(oprincipalcontext, susername, spassword, true /*enabled or not*/);              //user log on name             ouserprincipal.name = susername;             ouserprincipal.userprincipalname = susername + "@external.rootteck.com";             ouserprincipal.givenname = sgivenname;             ouserprincipal.surname = ssurname;             ouserprincipal.emailaddress = email;             ouserprincipal.displayname = sgivenname + " " + ssurname;             if (phone != string.empty) { ouserprincipal.voicetelephonenumber = phone; }             ouserprincipal.passwordneverexpires = true;              ouserprincipal.save();              return true;         }         else         {             return false;             //return getuser(susername);         }     } 


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -