O
OMAF-Terry
I've posted numerous times, searched, searched, searched and can't seem to
get an answer on this.
I have a C# web service that I want to query when infopath form starts. The
web method takes one parameter that is the username of the person using the
form (System.Environment.UserName).
That's all I want but I can't figure out how to do this in C#!
Someone suggested creating the 2nd data source and having the text field
populate onLoad but how do you do that when you need to submit parameter
first?
ANYONE???
Webservice:
=============================================
[WebMethod (Description="Get the full name of the form user.")]
public string getCurrentUserFullName(string localUserName)
{
DirectoryEntry entryFullName = new
DirectoryEntry("LDAP://ou=people,dc=on,dc=ca");
DirectorySearcher dsFullName = new DirectorySearcher(entryFullName);
dsFullName.Filter = "(SAMAccountName=" + localUserName + ")";
dsFullName.PropertiesToLoad.Add("givenName");
dsFullName.PropertiesToLoad.Add("sn");
SearchResult resultFullName = dsFullName.FindOne();
if(resultFullName == null)
{
return "Error finding user " + localUserName + " in Active Directory.";
}
string strCurrentUserFullName =
resultFullName.Properties["givenName"][0].ToString() + " " +
resultFullName.Properties["sn"][0].ToString();
return strCurrentUserFullName;
}
=============================================
get an answer on this.
I have a C# web service that I want to query when infopath form starts. The
web method takes one parameter that is the username of the person using the
form (System.Environment.UserName).
That's all I want but I can't figure out how to do this in C#!
Someone suggested creating the 2nd data source and having the text field
populate onLoad but how do you do that when you need to submit parameter
first?
ANYONE???
Webservice:
=============================================
[WebMethod (Description="Get the full name of the form user.")]
public string getCurrentUserFullName(string localUserName)
{
DirectoryEntry entryFullName = new
DirectoryEntry("LDAP://ou=people,dc=on,dc=ca");
DirectorySearcher dsFullName = new DirectorySearcher(entryFullName);
dsFullName.Filter = "(SAMAccountName=" + localUserName + ")";
dsFullName.PropertiesToLoad.Add("givenName");
dsFullName.PropertiesToLoad.Add("sn");
SearchResult resultFullName = dsFullName.FindOne();
if(resultFullName == null)
{
return "Error finding user " + localUserName + " in Active Directory.";
}
string strCurrentUserFullName =
resultFullName.Properties["givenName"][0].ToString() + " " +
resultFullName.Properties["sn"][0].ToString();
return strCurrentUserFullName;
}
=============================================