Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!
I don't know why, but creating user in AD gives me a user without "userPrincipalName".
I do it with the folowing code:
C#
using (DirectoryEntry companyEntry = companysDir.Children.Find("OU=" + companyName))
{
    DirectoryEntry newUser = companyEntry.Children.Add("CN=" + login, ADobj.User);
    newUser.Properties["samAccountName"].Value = login;
    newUser.CommitChanges();
    if (password != null)
    {
      newUser.Invoke("SetPassword", new object[] { password });
      newUser.CommitChanges();
    }
    newUser.Close()
}

The result is look like that:
HTML
<img src="http://s1.ipicture.ru/uploads/20120523/R02782Su.jpg">

And ofcourse user disabled. Why is this happens?
Posted
Updated 23-May-12 4:40am
v2
Comments
Ganesan Senthilvel 23-May-12 10:40am    
result HTML tag is formatted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900