Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

At my wits end with InfoPath and Sharepoint user pre-population

  Asked By: Tessa    Date: Dec 25    Category: Sharepoint    Views: 2415

I am trying to pull data from LDAP and pre-populate an InfoPath form
with that data. I was able to find a way to do this, not sure if it is
the best but it works fine inside InfoPath on my Virtual PC. Once I
move it to SharePoint and try to open a new document in the form
library it does not work. I did set it to Full Trust.

I am wondering if I could pull user data from SharePoint it's self if
that would be better. I have looked every where and some ideas from
here but nothing seems to work. Does anyone have an idea.



6 Answers Found

Answer #1    Answered By: Alicia Scott     Answered On: Dec 25

We're going to need more information than "it does not work". What
behavior did you expect, and what did you actually get? Was there an error
message, and if so, what was it? Where is the LDAP web service hosted? Is
there a permissions problem when you call it explicitly from the new

Answer #2    Answered By: Mike Lamb     Answered On: Dec 25

I do not get an error when I run it in Infopath, but when I run it
in sharepoint  I get this error:

An operations error occurred.

** I think there is more to the error, I submitted this artice a
couple of days ago

** I am not using a web service i am just using the code behind with
the code seen below.

here is the code in my load event:


// Get the user  name of the current user.
string userName = this.Application.User.UserName;

// Create a DirectorySearcher object using the user
// as the LDAP search filter. If using a directory
// than Exchange, use sAMAccountName instead of
DirectorySearcher searcher = new DirectorySearcher
("(sAMAccountName=" + userName + ")");

// Search for the specified user.
SearchResult result = searcher.FindOne();

// Make sure the user was found.
if (result == null)
//alert(string "Error finding user" + userName);
XPathNavigator xnMyForm = this.CreateNavigator();
XmlNamespaceManager ns = this.NamespaceManager;
("/my:webRequest/my:errorMessage", ns)
.SetValue("Error finding user" + userName);

// Create a DirectoryEntry object to retrieve the
// of attributes (properties) for the user.
DirectoryEntry employee = result.GetDirectoryEntry

string FirstName = Convert.ToString(employee.Properties
if (string.IsNullOrEmpty(LastName))
FirstName = "N/A";
FirstName = employee.Properties

string LastName = Convert.ToString
if (string.IsNullOrEmpty(LastName))
LastName = "N/A";
LastName = employee.Properties
string Mail = Convert.ToString(employee.Properties

if (string.IsNullOrEmpty(Mail))
Mail = "N/A";
Mail = employee.Properties

string Location = Convert.ToString

if (string.IsNullOrEmpty(Location))
Location = "N/A";
Location = employee.Properties

string Title = Convert.ToString

if (string.IsNullOrEmpty(Location))
Title = "N/A";
Title = employee.Properties

string Phone = Convert.ToString

if (string.IsNullOrEmpty(Phone))
Phone = "N/A";
Phone = employee.Properties

string Department = Convert.ToString

if (string.IsNullOrEmpty(Department))
Department = "N/A";
Department = employee.Properties

// Create an XPathNavigator to walk the main data
source of the form.
XPathNavigator xnMyForm = this.CreateNavigator();
XmlNamespaceManager ns = this.NamespaceManager;

// Set the fields in the form.
("/my:webRequest/my:ContactInformation/my:Requesters_Name", ns)
.SetValue(FirstName + ' ' + LastName);

("/my:webRequest/my:ContactInformation/my:Requesters_Email", ns)
("/my:webRequest/my:ContactInformation/my:Requesters_Phone", ns)

("/my:webRequest/my:ContactInformation/my:Requesters_Location", ns)

("/my:webRequest/my:ContactInformation/my:Requesters_Department", ns)

// Clean up.
xnMyForm = null;
result = null;

catch (Exception ex)
//MessageBox.Show("The following error occurred: " +
// ex.Message.ToString());
XPathNavigator xnMyForm = this.CreateNavigator();
XmlNamespaceManager ns = this.NamespaceManager;
("/my:webRequest/my:errorMessage", ns)
.SetValue(":" + ex.Message);

Answer #3    Answered By: Jose Scott     Answered On: Dec 25

o you went with the code-behind. As long as you're only loading
it when the form starts up, that should work  just fine.

Does the SharePoint server have access to the domain controller?

Also, are there any notable error messages in either the server's event logs
or the 12/LOGS folder? I'd suggest running a failed attempt and having the
logs ready to refresh right after you do it (to make the needle-finding a
little easier).

Answer #4    Answered By: Taylor Clark     Answered On: Dec 25

I assume the sharepoint  can talk to the domain controller, cause
the infopath  pulls the user  data just fine  on the server and we have
user accounts on the sharepoint site that are coming from AD accounts:

There where no errors in 12/logs folder, but i did see this error
several times in iis:

The SSP Timer Job Distribution List Import Job was not run.

Reason: Logon failure: unknown user name or bad password

Technical Support Details:
System.ComponentModel.Win32Exception: Logon failure: unknown user
name or bad password
entials(String userDomainName, String password, LogonType logonType)

Answer #5    Answered By: Anthony Rutledge     Answered On: Dec 25

I'm confused; I thought the infopath  form was *not* pulling the data
properly on the server. So you're saying that the data  does come in
correctly, but you're just getting an extraneous error message?

Answer #6    Answered By: Heena Nagori     Answered On: Dec 25

No when I open  a new form from the sharepoint  library list the form
does open, but there is no pre-populated data  being shown and the
only errors i could find  where in IIS like shown below. I assume it
has somthing to do with permissions in iss or somthing. I am running
the sharepoint site with a site admin account so that account should
have full  rights.