Udostępnij za pośrednictwem


Person / Group Picker Improvements in InfoPath 2010

Hi, this is Frank Mueller, a developer on the InfoPath team. In this post which is the first of two blog posts about the Person / Group picker, I want to tell you about the improvements we’ve made to this control in InfoPath 2010.

The Person / Group Picker (aka contact selector) control allows you to type or select users and groups from a SharePoint site, and validate those users against a directory provider. In InfoPath 2010, the Person / Group Picker control is now a 1st class citizen and is available out of the box in the controls gallery! With the new and improved person / group picker, we have eliminated the detailed steps required to insert and configure this control in your forms (the blog post outlining these steps has been one of our most viewed posts). In addition to making the control available in the controls gallery out of the box, we have added new features to improve its integration into SharePoint scenarios.

For information on how to upgrade InfoPath 2007 forms with Person/Group Picker controls to InfoPath 2010, click here .

Adding the Person/Group Picker to your form

From the Controls Gallery on the Home tab or the Controls task pane, click the Person/Group Picker to insert it into the view.

Controls Gallery

Specifying a SharePoint site to query for people and groups

The Person/Group Picker needs to connect to a SharePoint site to be able to function. Specify the SharePoint site as follows, unless you have already published the form to a SharePoint site, in which case that site will be used.

  1. Right-click the control in the view and select Person/Group Picker Properties from the context menu

  2. In the Person/Group Picker Properties dialog, select the SharePoint Server tab

  3. Type the URL of the SharePoint site you want to query

    Control Properties

  4. Click OK to close the dialog

Specifying data validation (optional)

In InfoPath 2010 it is now possible to mark the field the people picker is bound to as Cannot be blank. This means that users will not be able to submit a form without having entered at least one valid person or group in the control. You can mark a field as required by doing the following:

  1. Select the control in the view
  2. In the Properties tab in the Modify chunk, click the Cannot be blank checkbox

 

PPickerCBB

Testing the control

Preview the form in InfoPath Designer or publish the form to a SharePoint site and view the form, enter a name or logon alias, click the “Check Names” button and resolve the name! Alternatively, you can click the “Address book” button to perform a search if you do not know the complete name of the user.

For information on how to upgrade InfoPath 2007 forms with Person/Group Picker controls to InfoPath 2010, check out my other post here.

Frank Mueller

InfoPath Developer

Comments

  • Anonymous
    April 14, 2010
    When i try to use property promotion on the people picker control, the recieving column is blank. also if i set the default value of a text field to equal the displayname field of the peoplepicker control, this only works in infopath filler, the form is set to be browser enabled but when i try to view it through the browser after publishing to sharepoint, the value does not change when the peoplepicker is updated. I tried using a rule on a button to populate a text field with the value of the peoplepicker control, this has the same result. i.e. works in infopath filler but not when published to sharepoint and viewed through the browser. Is this expected or is a bug in beta? Regards, Craig.

  • Anonymous
    April 15, 2010
    In order to promote the people picker field you need to promote the fields under the group node not the group node itself.  For example, if you want to show the display name then you will need to promote the DisplayName node. The rules should work if you set the AccountId node instead of the DisplayName node.  The AccountId node should  be populated with the domain/alias.

  • Anonymous
    June 07, 2010
    This is a great advance, but is there a way to view the selected users' email? In Infopath 2007, I had to create additional text boxes and rules to get the email (as in this article: alecpojidaev.wordpress.com/.../infopath-codeless-programming-walkthrough). Does this improve any in 2010 ?

  • Anonymous
    June 07, 2010
    Melissa, as far as I know these additional steps are still required. To confirm that this is the case, I recommend that you post your question to the SharePoint 2010 forums: social.msdn.microsoft.com/.../threads

  • Anonymous
    June 09, 2010
    How do I enable the "Cannot be blank"? No matter what part of the control I select the "Cannot be blank" is disabled. How do I set the default value without having the user to press the lookup button? If I set anything in the AccountId - it just shows up in red text until the user presses the button.

  • Anonymous
    June 10, 2010
    In response to Lars Bo Wassini: To enable cannot be blank on the person/group picker, select the control in the designer and then go to the Properties tab in the ribbon.  In the Modify group, enable the Cannot Be Blank checkbox.  If this is disabled, can you please provide more context regarding your form?  Are you customizing a SharePoint list?  Is your form using an imported schema? Etc. Have you upgraded the control to the 2010 people picker? If not, read the following blog post on how to do this: blogs.msdn.com/.../upgrading-infopath-2007-forms-with-person-group-pickers-to-infopath-2010.aspx Default Value: Is is this issue occurring in the InfoPath client only? It should work by default when filling the form out in the browser. However, if you want the name to not appear in red you can set the DisplayName field to the same value as the AccountId.

  • Anonymous
    July 06, 2010
    The comment has been removed

  • Anonymous
    July 07, 2010
    The people picker does not display e-mail addresses. It displays user names. DomainUsername is not a valid e-mail address. This is why it won't resolve. For the e-mail submit to work, you need a valid e-mail address such as username@microsoft.com.

  • Anonymous
    July 28, 2010
    When I publish the AccountID and the Display Name, both fields display as domainuser.  Any insight as to why Display Name is not coming through properly?

  • Anonymous
    August 24, 2010
    Is there a way to set an "Action" rule for a People/Group field?  We would like to retrieve user profile data for the user selected in the People/Group field without having to write code.  Unfortunately, the option to create an "Action" rule against a People/Group picker field is disabled.  

  • Anonymous
    August 25, 2010
    Action rules based on the person field are not supported in InfoPath 2010. You will need to use code to do this.

  • Anonymous
    August 25, 2010
    We created code for handling the Person/Group field "Changed" event and attempted to deploy the form template as a sandboxed solution, but received the error "Code events on Person/Group Picker controls are not supported in sandboxed solutions."  Is there a way to enable Person/Group field event handling for InfoPath forms deployed as sandboxed solutions?

  • Anonymous
    September 03, 2010
    Funny, I dont have the SharePoint Server Tab under People Picker Properties what it shows under my Data Tab though is: that I must create a secondary data source and shows a format as <Context siteUrl="http://servername"/> Any ideas? I am running Office version 14.0.4763.1000

  • Anonymous
    September 04, 2010
    I have several people pickers in an InfoPath 2010 form -- a couple bound to single-occurring elements and another bound to an element within a repeating group which is laid out in a Repeating Table. Any idea why when as I enter data in different fields in the form, the people pickers disappear for a second, then reappear?   It does it in the client as well as if rendered in the browser on a SharePoint 2010 Server.  In the latter case, using a mouse to move about the form is a tricky affair as while the pickers are doing their vanishing act, the whole form is jumping all over the place! :o   I tried turning off the postback on all fields, except the people picker which doesn't have that option.  That didn't fix it.  Any other ideas? Thanks! :)

  • Anonymous
    December 03, 2010
    is it possible to prevent postback on this control?  it is resetting the caret and makes it impossible to tab through fields

  • Anonymous
    February 04, 2011
    This is well and good, but I want to be able to see the list of users in the group so I don't have to guess at the names.  I am finding very little useful (no-code) information on the internet.  I would think this is a very common request especially if an organization is using role-based security in Active Directory and they don't want to use SharePoint groups. Any suggestions?

  • Anonymous
    February 11, 2011
    OK, but how do you promote the person/group field in InfoPath as a person/group field in the SharePoint form library?

  • Anonymous
    March 08, 2011
    I'd also like the possibility to promote (publish) the person/group field as you can with lists.

  • Anonymous
    March 21, 2011
    I still do not understand why you can only pull down the users name, Network Username and type witout rewriting code.  There has to be an wasier way to query Active Directory and fill a form with this information.  Any ideas?

  • Anonymous
    April 18, 2011
    The comment has been removed

  • Anonymous
    April 28, 2011
    Why dont I see the Sharepoint Server Tab? I am using InfoPath 2010

  • Anonymous
    April 28, 2011
    Tara411, The SharePoint Server Tab is only present for InfoPath Filler forms (see File/Form Options/Compatibility) because there's no guarantee such forms will be linked to a SharePoint site. Once a template is published to a site, the people picker resolves against that site.

  • Anonymous
    July 21, 2011
    No, it doesn't. Well, at least when publishing to SharePoint 2007 it doesn't. I'm still having to add Context.xml as a data connection. Anyone know how to get the People Picker to automatically set itself to who opened the form? I tried setting AccountId to userName() as a default value, but it didn't work

  • Anonymous
    July 27, 2011
    I'mtrying to use the People Picker, but it does not appear in the Form. There occurs an error: "One or more ActiveX Controls could not be displayed". There appears only the small red x in the form instead. Any suggestions? This should be something with the IE security settings of my company, but which setting is it?

  • Anonymous
    October 02, 2011
    How to promote the people picker value to Form library Person and group column?

  • Anonymous
    October 07, 2011
    is it possible to add validation rule to Person control bound to SharePoint group like must have value when another field is set or so? I don't even get the option to set cannot be blank but I guess that's due to the field which is set to allow blank else I wanted to put validation on submit button but it doesn't allow it

  • Anonymous
    January 23, 2012
    The comment has been removed

  • Anonymous
    January 31, 2012
    The comment has been removed

  • Anonymous
    April 18, 2012
    We use a form to create and modify users ad accounts. The contact selector only retrieves active accounts. Unfortunately, when the person submitting the form enters a user name that for a person with an expired account they receive an ugly error. Is there a way to pull active and expired accounts?

  • Anonymous
    May 07, 2012
    The comment has been removed

  • Anonymous
    May 08, 2012
    If I add the people picker control to the form it puts it into a repeating group - so I am unable to promote the DisplayName to a SharePoint column. The group is also locked so I can't remove the check mark for Repeating. How can I get around this?

  • Anonymous
    May 08, 2012
    Hi Mahen, You are correct - the data structure for this control cannot be changed as it returns data based on that schema. So if you could change it, you would break the control. In addition, these nodes store the data as text (strings) so you cannot promote this to a "Person" column in SharePoint if that is your ultimate goal. If you want to promote just the Display Name column, you can - it just won't be a "Person" node. If the goal is to get this information into a "Person" node, then you can easily do this by promoting the AccountId node as a string and then use a SharePoint Designer workflow that starts when a new item is created and/or an existing item is updated and it simply sets your "Person" node to the value in the AccountId node. Scott

  • Anonymous
    June 01, 2012
    Hello Frank, My customers are getting '..CallBack Errors' when they try to use the control in a form I designed. The form is for a Form Library. When I use a List Library the control/form works ok. This is on a Company intranet. My Customers are in China, I'm in Ohio. Can this be a timeout error? Also, I did not specify the URL in the 2nd tab of the controls properties. I deploy the form, and assumed the URL would be realtive to the Sharepoint Site. Any advice on how to overcome the error? Thanks, Rwiethorn

  • Anonymous
    June 04, 2012
    We have encountered a strange behaviour of People Picker (SharePoint 2010 + Infopath 2010). Normally we need to click "Check Names" on the verify button in order to detect the user entered in the people picker. This is the behaviour we expect of infopath and SharePoint. However if there is any postback triggered of a control in the infopath, the people picker will then auto verify the user name (without click on the verify button). How we can do to prevent the auto verify user name of people picker?

  • Anonymous
    June 07, 2012
    Hi Scott, I want a combination of friendly display of people and I want the person object (with looks unfriendly, especially with claims where the domainusername has a "i:0#.w|" prefix). I think you are suggesting: use the people picker control in the form but promote the display name (that gives me my friendly display of people). Since I also need the account id, create additional columns (people groups type) directly in my form library and populate those values on create and modify actions using a Workflow. So if I have 3 people pickers, I actually need 6 columns in my form library. Did I get it right. Greg

  • Anonymous
    June 21, 2012
    Hi Greg, Yes - that is correct. However, once you populate a Person/Group node with the accountId, won't it display the "friendly" name? If so, then you just need to promote that one column as a string. Scott

  • Anonymous
    July 02, 2012
    I am having a problem where the Person Picker does not get selected when in error. All other "native" controls do. How can I fix this?

  • Anonymous
    August 27, 2012
    I have a SharePoint 2010 Infopath List form. In this form I have a people picker field and a Date picker field. Now I need to make people picker field Mandatory only when Date picker field is not blank. How can I do this as Action, validation are not available for People Picker and we cannot use custom code for an Infopath List form ? Please suggest.

  • Anonymous
    August 28, 2012
    Hi Ram, You are correct - there is not a way to add "formal" data validation to the People Picker control. But you can change the design just a little and get almost the same result. Here is an example: NOTE: My Person column is called: MyPerson and my date column is called: MyDate

  1. Add a new button to the form (this will be your Submit button now)     - Right-click the button, choose Properties and set the Action to: Submit     - Click the Submit Options button on the Ribbon (Data tab) and uncheck the option "Show the Submit button in both the Ribbon and the Info tab..."
  2. Add a new "Formatting" rule to the button as follows:     - Condition:          - If MyDate is not blank and AccountId is blank or Person is not present     - Formatting:          - Disable this control ** What this will do is disable the Submit button if a date has been entered/selected and the AccountId node for the Person control is still blank. (This gets populated when the name is validated.)
  3. Add a "Calculated Value" control next to the People Picker control and set the text property to an asterisk (I made it bold and red as well.)
  4. Add a "Formatting" rule to this Calculated Value control as follows:     - Condition:          - If MyDate is blank or MyDate is not blank and AccountId is not blank     - Formatting:          - Hide this control ** What this will do is show the red asterisk (like a required field) when a date has been entered and the AccountId node for the Person control is still blank. Although this is not true data validation Ram, it will prevent submitting the form if a date has been entered but a name has not been validated in the Person control. I hope this helps! Scott
  • Anonymous
    September 19, 2012
    Hi, Did anyone ever figure out what to do with the tab back problem that the picker causes? Thanks, Sara

  • Anonymous
    November 17, 2012
    i can understand on sharepoint share can you explain more.... clear??? http://www.pembolang.com

  • Anonymous
    December 11, 2012
    Hi, I am new to Infopath and have created one form with the help form Internet,now i am stuck in, i have already published the form on SP. I want when somebody opend the form it should come up with User name & email ID automatically, its possible i have seen in one form but dont know how to do this. Thanks in advance!!

  • Anonymous
    February 11, 2013
    In using 2010, does it correct this issue? • Problem: While the initiator fills out the form the contact selector works just fine. But when the  approver opens the form from Outlook we get the following message when we try to validate a user in the Contact selector: "This action cannot be performed from untrusted sites. To use Find, you must add this site to the list of trusted sites for your Web browser." • The reason you are seeing this behavior is when you open an InfoPath form from within Outlook it is being opened in the local IE cache (Temporary Internet Files) - as such, you will see this message. To allow the Contact Selector control to work in that scenario the form will need to be saved to the user's machine.

  • Anonymous
    May 23, 2013
    When I try to use the people picker in InfoPath 2013, it causes InfoPath to crash.  Any ideas? Problem signature:  Problem Event Name: APPCRASH  Application Name: INFOPATH.EXE  Application Version: 15.0.4420.1017  Application Timestamp: 5067334b  Fault Module Name: PEOPLE~1.DLL  Fault Module Version: 15.0.4420.1017  Fault Module Timestamp: 506733e2  Exception Code: c0000005  Exception Offset: 0000f279  OS Version: 6.2.9200.2.0.0.256.4  Locale ID: 1033 Additional information about the problem:  LCID: 1033  skulcid: 1033

  • Anonymous
    June 07, 2013
    I hate to say it but this is not the best thing you guys ever did.  I need a similar control but one that validates against Active Directory and not SharePoint.  You took that functionality away.

  • Anonymous
    June 27, 2013
    I added a Person column to a list and the person shows up as a hyperlink from the list view.  When I click on the person I get the user details. But when I add the person as a field to an InfoPath form, the name loses the hyperlink when viewed from the form.   Is there anyway to have the person hyperlinked from the form?

  • Anonymous
    July 22, 2013
    This for some reason does not apply to my 2010. i do not have the funtions you show here like the sharepoint server tab...?

  • Anonymous
    September 27, 2013
    I have an InfoPath 2010 form which is published to a form library in SP2010. I have added a Person/Group Picker control in the form which is intended to show only a particular group of people in my SP Site. For this I have selected the SharePoint Group property of the control and everythign set working in my development environment. But when I deploy this to production or other environment, the group setting seems to be not working there. I heard this control stores the Group by Id and not by the name and may the reason for this failure. Is there any workaround for this situation? thank you beforehand. raj

  • Anonymous
    October 30, 2013
    I am developing a collaborative site with SP 2010 and I've used an InfoPath form as contact information, including a person/group picker named "Contact" associated with Lync database. When I add the webpart with the form in it to the SharePoint the field "Contact" is displayed as text and not redirected to the Lync contact information. Is there any way to fix this?

  • Anonymous
    February 05, 2014
    No SharePoint Server or General tabs showing in Person/Group picker Control Properties :- We have set up a SharePoint 2010 development environment on a Windows 2008 R2 server. We've installed VS2010 SP1, Excel 2010 & InfoPath 2010. For some reason the InfoPath Person/Group picker generates controls that only have 3 tabs; Data, Size and Advanced in the properties. There are no SharePoint Server or General tabs showing. Any ideas on how to rectify this? Note we've only ever had InfoPath 2010 so it’s not a problem of migrating from InfoPath 2007.

  • Anonymous
    March 24, 2014
    Frank, I need to use a Rule on my InfoPath form to set the Person or Group field on my InfoPath Form Library.  I'm trying to use the [Me] keyword to filter the views on my form library bases on EDIPI numbers.

  • Anonymous
    January 23, 2015
    Hello all. My 2010 people picker works as advertised. However, I have 8 people picker fields. I need to 'Publish' 4 of them to SharePoint. They are all called "AccountId" and it is difficult to distinguish one from the next. Am I missing an easier way to determine which 'AccountId' belongs to which field? Thank you in advance.

  • Anonymous
    March 10, 2015
    nice blog, very useful and wish you more creative in making a useful article, a successful greeting. Regards http://www.seogereggi.com

  • Anonymous
    September 09, 2015
    The comment has been removed

  • Anonymous
    October 12, 2015
    The comment has been removed