InfoPath drop down/Simple web service question

O

OMAF-Terry

I'm trying to create a web service in C# to populate a drop down list with
Active Directory users.

How do I return what's found (if possble please provide code)? Then from the
InfoPath side, I've seen a couple different ways to receive the data such as

http://support.microsoft.com/?id=826994
http://blogs.msdn.com/davfries/archive/2004/06/29/169043.aspx
or adding a data connection

What is the best method to receive the data retrived from web service?


=======================================
public string getAdUsers()
{
DirectoryEntry entryAllUsers = new
DirectoryEntry("LDAP://ou=people,ou=peeps,dc=gov,dc=on,dc=ca");
DirectorySearcher dsAllUsers = new DirectorySearcher(entryAllUsers);
string [] strAttrs = new
string[]{"givenName","sn","mail","telephoneNumber"};
dsAllUsers.Filter = "(objectClass=user)";
dsAllUsers.PropertiesToLoad.AddRange(strAttrs);
return "???????";
}
}
}
 
H

Henning Krause [MVP - Exhange]

Hello,

as the example states, you could create an XML document to and populate it
with the results.

Another option would be to create a class with the necessary properties and
return an array:

[Serializable]
public class Entry {
public string givenName;
public string sn;
public string telephoneNumber;
}

[WebMethod]
public Entry[] GetUserList() {
// Put your code here
}

You can then add a secondary datasource to your InfoPath form.

Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)
 
O

OMAF-Terry

Thanks Henning for your reply. Is it possible for you to provide some code
example for me? I'm new to InfoPath and even newer to C#.



Henning Krause said:
Hello,

as the example states, you could create an XML document to and populate it
with the results.

Another option would be to create a class with the necessary properties and
return an array:

[Serializable]
public class Entry {
public string givenName;
public string sn;
public string telephoneNumber;
}

[WebMethod]
public Entry[] GetUserList() {
// Put your code here
}

You can then add a secondary datasource to your InfoPath form.

Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/software/mistaya.aspx)


OMAF-Terry said:
I'm trying to create a web service in C# to populate a drop down list with
Active Directory users.

How do I return what's found (if possble please provide code)? Then from
the
InfoPath side, I've seen a couple different ways to receive the data such
as

http://support.microsoft.com/?id=826994
http://blogs.msdn.com/davfries/archive/2004/06/29/169043.aspx
or adding a data connection

What is the best method to receive the data retrived from web service?


=======================================
public string getAdUsers()
{
DirectoryEntry entryAllUsers = new
DirectoryEntry("LDAP://ou=people,ou=peeps,dc=gov,dc=on,dc=ca");
DirectorySearcher dsAllUsers = new DirectorySearcher(entryAllUsers);
string [] strAttrs = new
string[]{"givenName","sn","mail","telephoneNumber"};
dsAllUsers.Filter = "(objectClass=user)";
dsAllUsers.PropertiesToLoad.AddRange(strAttrs);
return "???????";
}
}
}
 

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