InfoPath 2010/2013: UserInformationList query for current logged in user

Sometimes you just want to use more information like just the user id within your InfoPath form. Now you are able to use the SharePoint webservices but it is also possible to query the userinformation list in SharePoint. The result looks like this:

To achieve this goal it is just a few clicks away. What we need is a data connection to the relevant SharePoint. In my case I retrieve this data from our mysite url.

Be sure that the following options are unchecked:

Now we need a Form Load Action to set query parameter for the new data connection. Something like this:

And we also need to query the data connection to retrieve the relevant user information:

At least you need to create your form. You need a repeating table if you will show more than one result. But if you only show up the current user information you just add the dataFields of your secondary fields section.

That’s it!

..:: I like SharePoint ::..

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

Dennis de Vries About Dennis de Vries
Loving SharePoint, Social Media and like to work together with creative people all over the world.

12 comments on “InfoPath 2010/2013: UserInformationList query for current logged in user

  1. Hi, Nice article. I tried this but couldn’t get it working. I do not know what seems wrong, no error message, is just that no returned data from my sharepoint server. I’m using infopath 2013 and sp2013.

    thanks in advance.

    • Have you tried to this without using the filter? Just query all users within the user information list?

  2. Thanks for the info, I have it almost working but it get all users, not just the current user. Any suggestion?

    • Did you set the query parameter while the form is loading? You have to set it to “current user” or something else to get only one user. After that you have to load the query manually.

  3. Hi Dennis

    Can you please go into more details regarding the data fields setup. Like which user did you user in the set field value. My data fields only have repeating tables so it retrieves all the user instead of one.

    Please help
    Thank You

  4. Within the set field i use the function
    after that you need to load this query for the information list again with
    does this help?

    • Fast update:
      In InfoPath 2013 query field Name is in same format as returned by userName() function.

  5. SharePoint

    Nette Sache solange man das Formular im InfoPath startet. Aber sobald es auf der SharePoint-Bibliothek veröffentlicht wird, erscheint nichts. Der Abschnitt wird gar nicht angezeigt und ein einzelnes Feld bleibt leer.

Submit comment

Allowed HTML tags: <a href="">google</a> <strong>bold</strong> <em>emphasized</em> <code>code</code> <blockquote>

Please fill in the captcha: * Time limit is exhausted. Please reload CAPTCHA.