locked
SharePoint 2007 - Import from User Info List into InfoPath 2007 RRS feed

  • Question

  • We are using Sharepoint 2007 with InfoPath 2007 and are trying to pull names from the UIL and display the name last name first.  Such as Smith, John.  It seems to pull and display first-name first.  Any way of displaying last name first? Thanks for the assist.
    • Moved by Clayton Cobb Wednesday, May 11, 2011 2:56 AM 2007 question (From:SharePoint 2010 - Using SharePoint Designer, Infopath, and other customization)
    Tuesday, May 10, 2011 8:09 PM

Answers

  • Lee - is this a dropdown, or a text field?
    This is a text field that populates depending on the form and the path that the workflow takes.


    Then Melli's response should work, but you should definitely be using the UserProfileService for this.  I thought the whole time you were populating a dropdown, because getting just one name is super easy using the web service mentioned.

    When using UserProfileService.asmx, you can get FirstName, LastName, PreferredName, WorkEmail, Manager, and much more.  You would either substring the PreferredName like Melli showed or concatenate the FirstName with the LastName.


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by Wayne Fan Wednesday, June 1, 2011 2:59 AM
    Saturday, May 14, 2011 3:44 AM

All replies

    1. This is the 2010 forum, but your question is for 2007
    2. I highly recommend not using the User Information List, because it does not contain all users, and it does not get updated when user information changes in Active Directory
    3. Pulling from that list requires pulling the entire table, which will severely affect performance of your form unless you only have a small number of users
    4. The names are displayed however they're entered in Active Directory in the Full Name field, which is the PreferredName field in the SharePoint profile database
    5. I highly recommend using the User Profile Service instead: InfoPath - Get user information without writing code (extended)
    6. What is your actual business requirement for pulling these values, and are you not concerned with the fact it's an incomplete list unless you use code to delete and re-populate the names regularly (i.e. daily)?

    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Wednesday, May 11, 2011 2:55 AM
  • 1. There is no 2007 forum that I could find.

     

    2. We have a script that runs twice daily that updates the UIL.

     

    3.  We currently have only a small number of users

     

    4. That is good information to know. 

     

    5. I will look into this and see if we can implement that here. Thanks for the heads up

     

    6. See # 2.  

    Wednesday, May 11, 2011 12:30 PM
  • You can use a combination of formulas to switch the placement of the first name and last name.  Here's an example that swaps them out and puts a comma in between:

     

    concat(substring-after(field1, " "), ",", substring-before(field1, " "))

     

    *You can either use this formula in a new field, replacing the "field1" with the current field that holds the name.  Or you use this formula on your current name field, replacing "field1" with the value you are currently setting this field to.

    Wednesday, May 11, 2011 12:56 PM
  • But you can't use that formula to tell the dropdown how to display the names.

    Lee, it's in the pre-2010 InfoPath forum now.  There is are 15+ forums for 2007 questions - it's the main set of forums for all of SharePoint.  SP2010 only has 4 forums, all of which are relatively new.


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Thursday, May 12, 2011 2:15 AM
  • True, it cannot be used for dropdown.  Lee did not specify that this is a dropdown - he may be using this connection to set a field to an individual user based off a filter value. 

    Lee - is this a dropdown, or a text field?

    Thursday, May 12, 2011 12:36 PM
  • Lee - is this a dropdown, or a text field?
    This is a text field that populates depending on the form and the path that the workflow takes.
    Saturday, May 14, 2011 2:26 AM
  • Lee - is this a dropdown, or a text field?
    This is a text field that populates depending on the form and the path that the workflow takes.


    Then Melli's response should work, but you should definitely be using the UserProfileService for this.  I thought the whole time you were populating a dropdown, because getting just one name is super easy using the web service mentioned.

    When using UserProfileService.asmx, you can get FirstName, LastName, PreferredName, WorkEmail, Manager, and much more.  You would either substring the PreferredName like Melli showed or concatenate the FirstName with the LastName.


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by Wayne Fan Wednesday, June 1, 2011 2:59 AM
    Saturday, May 14, 2011 3:44 AM