While the contacts list is usually filled out for contacts that are outside the company, there are times when you would use a contacts list to store internal and external resources. Wouldn’t it be nice if you didn’t have to re-type your internal contacts’ information that are already in the system? Now you can with a little InfoPath customization on the contacts list.
Here’s our plan:
Let’s get going! Before we begin, make sure you have InfoPath 2010 installed locally on your computer. I also want to give credit Laura Rogers and Darvish Shadravan’s book Using Microsoft InfoPath 2010 with Microsoft SharePoint 2010 Step by Step. I know it looks like a lot of steps, but it’s easy once you get the hang of it.
So now we have our form open in InfoPath 2010. Let’s add our elements to the form.
We should end up with something like this:
Before we can populate the fields with user data, we need to create a connection to the User Profile Service.
Now we need to wire up the actions on our button to populate the fields with the information for the user in the people picker control.
If we didn’t do this and just queried the user profile service, it would load the data of the currently logged in user. So we need to tell the form what user to load the data for. We take the AccountID field from the people picker control and inject into the AccountName query field of the User Profile Service data connection.
We’re closing in on our goal. Let’s see our progress. We should see something like this:
Now that we have the user’s data read into the form, we can populate the fields in the contact form. The number of steps to complete will depend on how many fields you want to populate. We need to add an action step for each field. I’ll show you one example and then you will just repeat the steps for the other fields. Let’s update the Job Title field.
We’re going to update common fields that are in the user’s profile, and likely from Active Directory. You can update fields like first and last name, company, mobile and work phone number, etc. For the other fields, the steps are the same except the Field you choose to update from the form, and the very last step where you enter the text will change. Here’s what the rules look like when we’re done:
We’re all done, good work! You can preview the form and try it now. Click Ctrl+Shift+B to preview the form. Once you’re satisfied, you can publish the form back to the library. Click File –> Quick Publish. Once it’s done, you will get confirmation:
Now open your form in SharePoint. From the contact list, click Add new item. Type in a name, and click the button and watch the magic happen!
Thanks a lot... U saved my life...
Hi there Doug - this is a brilliant how-to! However, I'm having issues. Once I've got to the point of testing, I come across this error, even when trying to retrieve my own data. Any ideas? ******************* Some rules were not applied. The query cannot be run for the following DataObject: GetUserProfileByName InfoPath cannot run the specified query. The SOAP response indicates that an error occurred: Operation Failure ---> Access Denied: To create a user profile, you must be an administrator, or create your own profile and have personal features rights. UnauthorizedAccessAccess Denied: To create a user profile, you must be an administrator, or create your own profile and have personal features rights. ******************************************************
Thedicewoman, Could be a couple things causing this, but my suspicion is obviously per the access denied, your account doesn't have permission on the User Profile service to make the query. Test this by going to this url in the browser: https:///_vti_bin/userprofileservice.asmx You should get a list of stuff. Assuming you have access to the SharePoint server, go to Central Administration and the user profile service, then Manage User Permission. See if the authenticated / all authenticated groups have the User Personal Features option checked. If not, as a test add your account and check it, click Ok then re-test. It could also be funky permissions on the service application itself, in the list of sevice applications. Highlight the UPS, and click permissions and see whose listed. Hope that gets you in the right direction. Doug
Ah okay - I'm guessing by the "This page can't be displayed" error that it's all down to permissions. Thanks for your help - I guess the users will just have to be happy with manual entry for now as it's unlikely I'll get permissions from my organisation - they're not very forward-thinking on the efficiency that proper SharePoint dev can provide! Thank you so much for your swift and thorough answer!
Thedicewoman, My url wasn't write before, it was supposed to be http:///_vti_bin/UserProfileService.asmx?WSDL (or https). This is a generic permission, and if the admins are carefully rolling out My Sites, this might be why it's turned off. Here's a description of what it is with instruction on how to check it: https://technet.microsoft.com/en-us/library/ee721063(v=office.14).aspx There are multiple places permissions with the profile service could be, but that's the first place I would start. Good luck! Contact me if you need further help. Doug
Hi Doug, I followed your instructions, I click "Preview" to load the page, after I filled out the network user ID in People Picker field, when I click "Click here to Load user data!" button, first click will load the local user profile (myself), second click load the correct user profile. I have verified the data connection that I created the “Automatically retrieve data when form is opened” is unchecked. How do I make just one click to populate the desire user data. Please advise. Erik
I'm having the same problem as Ziauddin. Can you help me, please?
@Honey / ziazai: I am not able to reproduce this issue. Once the form is published and you fill out a new item, no matter how many times you click the button, nothing happens? Are you sure you have a query data connection action on the button? Also, are you running claims or classic web applications? Claims web apps might cause issues reading the user profile service. @Erik, I assume this happens when fully published as well? do you click the resolve name button on the people picker field before clicking on the load user data button? Look through the Rule Inspector to make sure you don't have 2 query data source rules anywhere, perhaps on form load by accident?
Hello nbk,If you have it working on one, then no I wouldn't think you would need to engage support. It is tricky to get everything just right so it works properly. It sounds like the other populate actions aren't wired right. Is it correctly pulling from the picklist, if you enter a different user other than yourself? If so and the Job title works, go back and check the other actions. Each respective action should reside on the same field (i.e. the Job Title action should be on the Job title field, Company action on the company field, etc.). When I get time, I will try this in my Office 365 environment as well to make sure this works 100%. I'm glad you like the article, I appreciate the comments.
Doug: Thank you very much for your response.I was successful in retrieving all the fields of my choice on both a Contact list as well as a custom list (as the fields were not wired appropriately earlier and that is how I was not successful in my 1st attempt). One another note here...this works great when the person from a group has Full control on the list and not otherwise.
Thank you again for this wonderful tutorial!
Excellent post, but I have one question.
All of the fields are being pulled in except for AboutMe. Is there anything I am missing? What do I have to do different to get the AboutMe information pulled into a field?
Dear Doug, Your this post is excellent and very easy to apply because of snapshots. I read your post and applied in project. "the Person/Group Picker" is working fine but when I click the button no error comes and no data populate to the text fields. As a test case I tried this process three times, twice on Employee No and once on email but nothing populated. I am 100% sure that I did exactly same as per your article. Could you please advise the resolution of the issue. Your swift reply would be appreciated please. Ziauddin
SPbb,This unfortunately is a catch-all error message, and is hard to pinpoint exactly what could be wrong. A couple things:- Check your web service data connection. What is the path you are using? It should be like http:///_vti_bin/UserProfileService.asmx?WSDL. - Are you using SharePoint Online, or on premise? If on premise, what 2010 build do you have?- Have you checked the ULS logs when the error occurs and check the Correlation ID? That might yield a more detailed error. You could also make a new blank form outside of SharePoint, wire up 1 field with the data connection, and publish to a form library just to test the basic steps and working on the data connection and as a web form. If all that works, there's something wrong in how you wired the contact form, permissions or something like that. Hope it helps!Doug
Hello Doug,Thanks for the quick reply and help!I'm using Sharepoint 2010 Online. Ill try to do it again and update you the result.SPbb
SPbb,I am seeing many threads with users having issues connecting to WDSL web services in SharePoint Online. I think this might be related to your problem. Some folks have gotten the current username field to work, but not the other fields. Assuming you have the E3 plan or whatever that gives you InfoPath form services and BCS, I would open a ticket with Online support to verify exactly what is the supported web service methods from InfoPath. Regards,Doug
Hello Doug,Yes, my Sharepoint 2010 Online is E3.Your help is very much appreciated!SPbb
Doug: This is one of the best instructions that I have seen(so very precise and to the point with appropriate screen shots for user's reference). Thank you very much!I tried ditto-to-ditto but the fields seem to work ONLY for Job Title and not the rest.... so has this got to do anything with your 1st response wherein you recommended a ticket be opened with Online support to verify exactly what is the supported web service methods from InfoPath??From the wsdl this is what I was able to locate this data, so any insight further will be of great help. Thank you!
Thanks for sharing this!But Infopath mode using the preview CTRL+SHIFT+B works but in my site "Sharepoint 2010 E3" I got this error msg***********************************************An error occurred querying a data source. Click OK to resume filling out the form. You may want to check your form data for errors. Hide error details An error occurred while trying to connect to a Web service.An entry has been added to the Windows event log of the server. Log ID:5566***********************************************Any idea?Your help is very much appreciatedSPbbCorrelation ID:d3502c27-2c60-4c47-a5f5-879cf2972f95
The complementary paper includes over 12 years of research, recent survey results, and CRM turnaround success stories.
This 60-second assessment is designed to evaluate your organization's collaboration readiness.
Learn how you rank compared to organizations typically in years 1 to 5 of implementation - and which areas to focus on to improve.
This is a sandbox solution which can be activated per site collection to allow you to easily collect feedback from users into a custom Feedback list.
Whether you are upgrading to SharePoint Online, 2010, 2013 or the latest 2016, this checklist contains everything you need to know for a successful transition.