Office

InfoPath – What can it do for you – part 7

In this part of my InfoPath series I want to show you how you can use the SharePoint web services. The most interesting one is the GetUserProfileByName. This web service makes it possible to extract profile information, such as name or manager, from the SharePoint user profile. The form can automatically fill certain fields with these values. This saves the user a lot of time filling the form.


I want to continue with the hardware request form from the previous article. This form contains the fields Name, E-mail and Manager. These fields need to be automatically filled when the user opens the form. We can use the web service by adding a new data connection. Click at Data, From Web Service and SOAP. Now we only have to add the following URL:


http://siteurl/_vti_bin/UserProfileService.asmx?WSDL

In the following screen an overview of the available web services is presented. We only need the GetUserProfileByName. I click at Next until the we can rename the Data Connection. I would advice to use a name such as RetrieveUserInformation so you know what the Data Connection does 😉


The fields Name and Manager use the Person/Group control. It is not possible to set a default value at this control. We have to replace them with a text box control. I select the properties of Name and will change the default value. This can be seen in the following screenshot:



Now we have to click at Filter Data:


We have to choose the field Name from the Data Connection as you can see in the first screenshot. In the second screenshot you can see PreferredName. This refers to the profile field Name (Display Name) from the user profile properties. You can use different values! Also custom user profile properties. To see the available properties go to the User Profile Properties in the User Profile Service Application. 

I also execute the same steps for E-mail (WorkMail) and Manager (Manager). We will see the following:




The Manager field shows the account name. I know there must be a way to just show the display name of the manager. One tip: Set the fields at read-only so the users cannot change these values 🙂
I started working with web services, years ago with InfoPath 2007, after I found this blog:

The following SharePoint experts know everything about InfoPath:

Laura Rogers:

Clayton Cobb

This is my last InfoPath blog for now, I will definitely talk more about it in the future 🙂

You Might Also Like

No Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.