Getting the User Profile for the current logged in user
Each site in SharePoint has a service called UserProfileService that allows you to access user data, below are the basic instructions on how to use it from an InfoPath form in SharePoint.
Before we look at it though, we need to discuss the structure of the SharePoint site collections and sites. A Site collection is a site itself but also the root parent site for other sites. When using the this service, you need to use the version in the _vti_bin of your parent site collection, I don’t why but for some reason you will need to give the user “Manager user profile” permissions if you don’t, and this will bring up a whole other can of security worms.
So lets setup our UserProfileService in InfoPath (I am using InfoPath 2010, so there may be some differences here).
First we need to create a Data Connection in the InfoPath form, which is pretty simple enough, see the screen shot below:
There are some tricks to getting this setup correctly:
- Make sure you select “SOAP Web service”.
- The service exsists in the _vti_bin folder of every site: http://mySite/myCollection/_vti_bin/UserProfileService.asmx
- Always append the following to your service url: ?WSDL, so http://myurl/myCollection/_vti_bin/UserProfileService.asmx will become http://myurl/myCollection/_vti_bin/UserProfileService.asmx?WSDL
- Select "GetUserProfileByName" for the operation, and leave the parameters blank. If you leave this blank, it will use the current logged in user as the parameter.
When it comes to using it, it is very simple (I set mine up to get the data on the Form Load event):
- Set up the rule to query for data using the data connection we setup above:
- The return data is a bit confusing at first, but once you get to grips with it, it is pretty simple:
You will need to grab the Value field, and then filter the data by using the Name field:
below is a list of all the values you can plug into the Name field to filter the Value field by, but, this is just the standard list, if you add a custom property in the User Profile Service in Central Administration, you can filter to get that data as well.
- UserProfile_GUID
- AccountName
- FirstName
- LastName
- PreferredName
- WorkPhone
- Office
- Department
- Title
- Manager
- AboutMe
- PersonalSpace
- PictureURL
- UserName
- QuickLinks
- WebSite
- PublicSiteRedirect
- SPS-Dotted-line
- SPS-Peers
- SPS-Responsibility
- SPS-Skills
- SPS-PastProjects
- SPS-Interests
- SPS-School
- SPS-SipAddress
- SPS-Birthday
- SPS-MySiteUpgrade
- SPS-DontSuggestList
- SPS-ProxyAddresses
- SPS-HireDate
- SPS-LastColleagueAdded
- SPS-OWAUrl
- SPS-ResourceAccountName
- SPS-MasterAccountName
- Assistant
- WorkEmail
- CellPhone
- Fax
- HomePhone
Disclaimer:
Please read the disclaimer if you plan on using anything from this article.
Using hyperlinks in a repeating list in an InfoPath form.
I have been struggling to display a link stored in a text field in a SharePoint list. I use a K2 SMO to get the data on view load.
I have finally found a way to display it correctly, and get it to encode the URL. My mistake was that I was using the Hyperlink control, what you should do is use a normal hyperlink (Insert tab-> hyperlink), when you edit he url, you can select a datasource for the link and also display text.
After this simple change, the links all display correctly in the repeating table and users are able to click on them and open the documents that they point to.

