S
SethMW
Hi,
I have a form where I need to lookup some user info OnLoad, and I am having
some issues. I don't know much about AD, but I suspect this is a permission
type problem.
In my form, I have the code below. This works fine from my VPC where I am
developing this, and it works fine in our production environment when opened
with InfoPath, but it gives a cryptic error when opening it in a browser. I
can get more information on the error, if need be, but I suspect it has to do
with the account the browser form is running as, and querying AD with. Is
there anything I need to do to allow a browser based IP form to query AD?
Anyway, here's a summary of my code, if we need to look there...
DirectoryEntry entry = new DirectoryEntry();
entry.Path = _ldapPath;
entry.AuthenticationType = AuthenticationTypes.Secure;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + account + ")";
search.PropertiesToLoad.Add("givenName");
search.PropertiesToLoad.Add("sn");
search.PropertiesToLoad.Add("initials");
search.PropertiesToLoad.Add("telephoneNumber");
search.PropertiesToLoad.Add("manager");
string manager;
if (result != null)
{
manager = result.Properties["manager"][0].ToString();
search = new DirectorySearcher(entry);
search.Filter = "(distinguishedName=" + manager + ")";
search.PropertiesToLoad.Add("SAMAccountName");
result = search.FindOne();
string manager =
result.Properties["SAMAccountName"][0].ToString());
}
Any help would be greatly appreciated.
Seth
I have a form where I need to lookup some user info OnLoad, and I am having
some issues. I don't know much about AD, but I suspect this is a permission
type problem.
In my form, I have the code below. This works fine from my VPC where I am
developing this, and it works fine in our production environment when opened
with InfoPath, but it gives a cryptic error when opening it in a browser. I
can get more information on the error, if need be, but I suspect it has to do
with the account the browser form is running as, and querying AD with. Is
there anything I need to do to allow a browser based IP form to query AD?
Anyway, here's a summary of my code, if we need to look there...
DirectoryEntry entry = new DirectoryEntry();
entry.Path = _ldapPath;
entry.AuthenticationType = AuthenticationTypes.Secure;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + account + ")";
search.PropertiesToLoad.Add("givenName");
search.PropertiesToLoad.Add("sn");
search.PropertiesToLoad.Add("initials");
search.PropertiesToLoad.Add("telephoneNumber");
search.PropertiesToLoad.Add("manager");
string manager;
if (result != null)
{
manager = result.Properties["manager"][0].ToString();
search = new DirectorySearcher(entry);
search.Filter = "(distinguishedName=" + manager + ")";
search.PropertiesToLoad.Add("SAMAccountName");
result = search.FindOne();
string manager =
result.Properties["SAMAccountName"][0].ToString());
}
Any help would be greatly appreciated.
Seth