Click here to Skip to main content
15,910,980 members

Comments by Emmanuel Cerna (Top 2 by date)

Emmanuel Cerna 19-Mar-14 18:35pm View    
Hi, I'll really appreciate your help...
Im trying to use this code to my visual basic app, to work in my AD
....this is how i addapted to my network...

//this is my button ADD USER
=====================================================================
private void Button_Click_1(object sender, RoutedEventArgs e)
{
string stringDomainName = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
PrincipalContext PrincipalContext4 = new PrincipalContext(ContextType.Domain, stringDomainName,
"LDAP://133.x.x.196/OU=Test,OU=Location,DC=bs,DC=sanluis,DC=net", ContextOptions.SimpleBind, txtadminuser.Text, txtadminpassword.Password);

UserPrincipal UserPrincipal1 = new UserPrincipal(PrincipalContext4,
txtlogin.Text, txtpassword.Password, true);

UserPrincipal1.UserPrincipalName = "PRUEBA USUARIO";
UserPrincipal1.Name = txtnombre.Text;
UserPrincipal1.GivenName = txtnombre.Text;
UserPrincipal1.Surname = txtapellido.Text;
UserPrincipal1.DisplayName = txtnombre.Text + " " + txtapellido.Text;
UserPrincipal1.EmailAddress = txtmail.Text;
UserPrincipal1.EmployeeId = txtid.Text;

}
======================================================================================
When I compile, the Visual Studio dont detect any errors.
But when I execute, it detecs this error:
0x80005000
apparently on the code line:
UserPrincipal UserPrincipal1 = new UserPrincipal(PrincipalContext4,
txtlogin.Text, txtpassword.Password, true);

I hope you can help me to solve this issue. I guess is something about the connection but I really don't know. Thanks for attention!
Emmanuel Cerna 18-Mar-14 16:46pm View    
I already read that post, but I really need your help to create my LDAP
from the data that I told you in the post. There's a picture too, so you can understand my AD structure.
PLEASE AND THANKS FOR HELP!