mercredi 4 mars 2015

How to set time out for PrincipalContext Constructor


Vote count:

0





using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, Domain, UserName, Password))
{
UserPrincipal qbeUser = new UserPrincipal(ctx);
qbeUser.GivenName = strFirstName;
qbeUser.Surname = strLastName;
qbeUser.EmailAddress = strEmail;

PrincipalSearcher srch = new PrincipalSearcher(qbeUser);

foreach (var principal in srch.FindAll())
{
var p = (UserPrincipal)principal;
if (!User.Any(x => x.Email == p.EmailAddress))
{
MyUserDataset.UserRow User = User.NewUserRow();
User.FirstName = p.GivenName;
User.LastName = p.Surname;
User.UserName = p.SamAccountName;
User.Email = p.EmailAddress;
User.AddUserRow(User);
}
}
User.AcceptChanges();
}


I'm using the PrincipalContext class above to establish a connection to the target directory and specify credentials for performing operations against the directory.


Does any one know how i can also specify the connection time out in the PrincipalContext Constructor?, i'm running into connection time out issues & i was wondering if i can control after how long the connection can time out.



asked 9 secs ago







How to set time out for PrincipalContext Constructor

Aucun commentaire:

Enregistrer un commentaire