Using SharePoint Web Services to Fill Out an InfoPath Form

Written By: Rebecca Jones -- 10/28/2010 -- join -- contribute -- (17) comments -- printer friendly version

Rating: Rate --

Categories: Design, InfoPath, MOSS 2007, SharePoint 2010, SharePoint Foundation 2010, WSS3

< Prev - 1 | 2 | - Next > | Become a paid author


When filling out forms users tend to use nicknames, initials, or non-given names to represent their birth names. If the form is an official document then this is not acceptable. To fix this issue, the creator of the form can automatically fill in the name portion of the form with the name of the person who is filling out the form. This can be accomplished using web services.


This solution will show you how to automatically fill in the name of the person filling out the form. For example purposes I will use the Travel Request Form to demo the solution.

Open your InfoPath form in designer view.

Creating Data Connection

First a connection needs to be made to web services. To do this click on Tools-> Data Connections...

A new window will open like the picture below. Click On Add...

Select the radio button next to Receive data. Then click Next >

Select the radio button next to Web service. Then Click Next >

data connection 4

Next we are asked to input the URL of the web service. You may be wondering what exactly is the web service. A quick and simple definition is that it is a way to grab information from SharePoint remotely to be used in web applications, forms, etc. For more information on what information can be accessed using web services check out this link:

The URL to access web services is: http://address of sharepoint site/_vti_bin/UserProfileService.asmx. So for instance if the address of my SharePoint site is then to access web services I would use We are putting UserProfile at the end because this is the service that pulls the user information from SharePoint. See the link above for other services. If you type the address above into a browser you will see something similar to the below picture...

Click Next >

Next we are presented with a list of methods to choose from. Select the GetUserProfileByName method and click Next >.

At the next screen leave the default value and click Next >

Click Next at the next screen. Do Not check the check Box.

Lastly you can leave the default name that appears on the last screen. Make sure to check the box next to "Automatically retrieve data when form is opened". Click Finish.

We have now completed creating a connection to the web service. Now the fun really begins.

< Prev - 1 | 2 | - Next >

Learn more about SharePoint

Sponsor Information

Copyright (c) 2010-2017 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | contribute | feedback | about
Some names and products listed are the registered trademarks of their respective owners. |