Don't know if I should put this into the old
http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=554thread but anyway.
As I couldn't get it work I came up with another solution. I wrote a small WebService and read all members from a AD group, or better the eMail addresses of them. In my InfoPath document I populate a DDL with theses values using the connection wirzard for WebServices. Not exactly what I wanted to have but still better than nothing.
The basics I found here
http://forums.asp.net/thread/1159654.aspx and I tailored it to my belongings. For those who are interested here is the code I am using for my WebService:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.DirectoryServices;
using System.Text;
using System.Diagnostics;
using System.Web;
using System.Xml;
using System.Web.Services;
namespace GetADGroupMembers
{
public class Service1 : System.Web.Services.WebService
{
public Service1()
{
InitializeComponent();
}
private IContainer components = null;
private void InitializeComponent()
{
}
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
//for repeating structure
public struct MemberMail
{
public string eMail;
}
[WebMethod]
public MemberMail[] GetMemberMail()
{
MemberMail[] mails = null;
DirectoryEntry group = new DirectoryEntry(
"LDAP://CN=ADGroupName,OU=ThirdOU(group is in this OU),OU=SecondOU,OU=TopOU Worldwide,DC=dc1,DC=dc2,DC=dc3", //change this how you need it
null,
null,
AuthenticationTypes.Secure
);
StringBuilder sb = new StringBuilder();
sb.Append("(|");
using (group)
{
foreach (string s in group.Properties["member"])
{
sb.AppendFormat("(distinguishedName={0})", s);
}
}
sb.Append(")");
DirectoryEntry searchRoot = new DirectoryEntry(
"LDAP://dc=corp,dc=huskyims,dc=com",
null,
null,
AuthenticationTypes.Secure
);
using (searchRoot)
{
DirectorySearcher ds = new DirectorySearcher(
searchRoot,
sb.ToString(),
new string[]{"mail"} // read here what ever you want e.g. nick samaccountname etc.
);
using (SearchResultCollection src = ds.FindAll())
{
mails = new MemberMail[src.Count];
int i = 0;
foreach (SearchResult sr in src)
{
foreach (string key in sr.Properties.PropertyNames)
{
if(key == "adspath")
{
}
else
{
foreach (object o in sr.Properties[key])
{
mails.eMail = o.ToString();
i++;
}
}
}
}
}
return mails;
}
}
}
}
That's it may be someone can use it