Can I connect an Infopath dropdown list to an Active Directory?

C

Carie

I need to populate a dropdown list on an Infopath form with the members of an
Active Directory group. Can this be done, and if so, how? Thanks.
 
J

Jeffshex

It should. Go to the contacts or members section and copy the location from
your browser. When you go to your drop down list properties, there are 3
choices at the bottom for receiving data...one of those happens to be from
sharepoint location. Click on that one and then you should be able to paste
your location right there.
I tried it and it basically worked. As far as more advanced sorting or
features I'm not too sure.
Hope that helps some.
 
B

B King

Accessing AD from code within InfoPath is very cumbersome. Since it
requires a fully trusted form and code. The best way to do this is to
call a web service that will return a list of names.

Below is a WebMethod I just finished recently to do the same thing:

[WebMethod]
public string[] QueryAllinADSI()
{
DirectorySearcher ds = new
DirectorySearcher("(&(objectclass=organizationalPerson)(physicalDeliveryOfficeName=*))");

ds.PropertiesToLoad.Add("displayName");
SearchResultCollection results = ds.FindAll();

string[] EmployeeList = new string[results.Count];
int i = new int();
i = 0;

foreach(SearchResult employee in results)
{
try
{
ResultPropertyValueCollection EmployeeCol =
employee.Properties["displayName"];
foreach (Object prop in EmployeeCol)
{
EmployeeList[i++] = prop.ToString();
}
}
catch (Exception ex)
{
EmployeeList[i++] = "Error: " + ex.Message;
}
}

Array.Sort(EmployeeList);
return EmployeeList;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top