I have some code in an InfoPath form that retrieves user information from Active Directory. My problem is that when it tries to retrieve the information and one of the fields in the AD users properties is blank the form displays an error and when it opens it doesn't autopopulate any of the fields.
How can i get the code to simply display a blank field and open the form without errors and populate all the fields that have information and the ones that don't have information, just leave blank so the user can fill them in?
Here is my code snippet (It loads fine for me, but if i go and take out the information in the Address field and reopen the form i get the error.)
public
{
((
EventManager.FormEvents.Loading +=
}
xnMyForm.SelectSingleNode(
.SetValue(FullName);
.SetValue(Mail);
.SetValue(Location);
.SetValue(MailStop);
.SetValue(Phone);
.SetValue(Department);
xnMyForm =
searcher.Dispose();
result =
employee.Close();
ex.Message.ToString());