Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

Using the Contact Selector Control

Using the Contact Selector Control

Rate This

(This post applies to InfoPath 2007. If you're using InfoPath 2010, then you should check out this post instead.)

We have seen a number of requests on how to allow a user to enter (or select) a person’s name or logon alias and then validate that user against their Active Directory without using code. This has been especially true in workflow scenarios where User A needs to enter in the name of User B – the next person in the workflow process.

Well, InfoPath 2007 ships with a control called Contact Selector Control that will resolve these issues! You may have seen our older article on the subject; this one aims to dive in deeper.

The Contact Selector control is an ActiveX control but it is a special cased control, in that it can also be used in InfoPath browser forms. To use this control there are specific steps that need to be taken – let’s take a look at those now.

Step 1: Add the Contact Selector control to your Controls Task Pane

1) From the Controls Task Pane click the Add or Remove Custom Controls link

2) Click the Add button

3) On the first screen of the Add Custom Control Wizard select ActiveX control and click Next

4) From the list of controls, choose Contact Selector and click Next

5) Select “Don’t include a .cab file” and click Next

6) For Binding Property select Value and click Next

7) From the Field or group type box choose Field or group (any data type) and click Finish

8) Click Close and then click OK


Step 2: Create the data structure for the Contact Selector Control

The Contact Selector control needs to have a specific data structure to work properly – this is documented on the “Items” tab of the Properties screen for the control; however, we’ll include that information here as well.

**IMPORTANT!** Spelling and capitalization must be exactly the same, starting with the “Person” group!

1) Add a non-Repeating Group named: gpContactSelector

2) Add a Repeating Group named: Person

3) Add the following 3 text fields to the Person group: DisplayName, AccountId and AccountType

Step 3: Add and bind the Contact Selector control to the View

1) Drag the gpContactSelector Group to the View and select “Contact Selector” from the list of controls

2) You’re almost done…! :-)

Step 4: Add a secondary data source XML file which specifies the SharePoint server

The Contact Selector control needs to know the “context” of where the user validation should occur. These steps are not necessary if you are only displaying the form in a browser from SharePoint – in this case, it uses the context of the site from where it was provisioned; however, if you are in a mixed client/browser scenario you will need to include this XML file so forms opened in the client can use this functionality.

1) Launch Notepad

2) Copy and paste this one-line XML:

<Context siteUrl="http://<servername>"/>

**NOTE: Replace <servername> with the name of your server

3) Save this as: Context.xml (again – naming and capitalization are important)

4) Add Context.xml as a “Receive” type Secondary Data Connection to your form template and make sure the option “Include the data as a resource file” is enabled

Step 5: Test!

You should now be able to Preview the form, enter a name or logon alias, click the “Check Names” button and resolve the name! Alternatively you could click the “To” button to perform a Search if you do not know the complete name of the user.

One other important point: if this control is something you will use numerous times, this process works great to create a “Contact Selector Template Part” – then you only have to complete these steps one time!

Scott Heim
Support Engineer

Leave a Comment
  • Please add 1 and 8 and type the answer here:
  • Post
  • "The Contact Selector control is an ActiveX control but it is a special cased control, in that it can also be used in InfoPath browser forms."

    I want to make one of those, too; can you tell me how (or at least point me in the right direction)?  In other words, although creating ActiveX controls has been documented here I haven't found similar documentation on making those "Complex InfoPath Controls" also work in browser mode (a.k.a. in InfoPath Forms Server).


    - Oli

  • Oli,

    Unfortunately, there is no way to embed a custom ActiveX or any other custom control into a browser-enabled form template. However, there's a workaround: host a browser-enabled InfoPath form in a custom ASPX page by using the XmlFormView control, and place your custom control into that hosting page. Then, configure events between the form and the hosting page appropriately.

    Good luck,


  • Hi Alex and thanks for answering quickly...

    I know you can't embed an ActiveX control in the browser version of the form, but presumably this "Contact Selector Control" implements both an ActiveX interface and a "browser-enabled" interface to work in both the rich client and the forms server environments.  The same way the TextBox control, the Date Picker and all of the other "browser-enabled" InfoPath controls do...  What I'm trying to find out is what interface do I implement and/or which attributes do I decorate my class with so that my custom control will count as "browser-enabled".

    In case my question is still vague, Bob Mixon and I have posted to the InfoPath newsgroup asking the same question in different terms:

    ...but we didn't manage to get your attention.

    Your assistance in this matter would be greatly appreciated!

    - Oli

  • Oli, I'm sorry, there really is absolutely no way to do this. The contact selector is a "private handshake" special case. There aren't any interfaces you could implement. No ActiveX or other custom control will work in a browser form, period. This is currently a by-design restriction; we are carefully considering improving this in v.Next.

    Try the workaround I mentioned above.



  • Okay, I have seen this question asked numerous places on the internet and never seen it answered so maybe you guys can help out.  

       Is it possible to add additional fields to the Contact Selector Control?  DisplayName, AccountID, and AccountName are all helpful but we have use for more than just these particular fields.  I know other fields are out there because when I use the contact selector to search for a user, I see other information about them in the Select Names window.  Items such as Title, Department, etc (which are probably unique to our Active Directory).  Is there any way the Contact Selector can pull these fields as well?

  • Hi,

    I believe the only fields that are available are what you get in the data structure. If you need additional A/D type of information, you can get this through .NET code.



  • Hi,

    i have a browser form (infopath 2007) which is hosted in a share point 2007

    form-libary. In the submit options i defined that the form should be submited

    to a mailaccount. That works well, but in the e-mail the contact selector

    isn't displayed as text. It's displayed as a blank image, but all other

    controls (textfield,datefield) are correctly displayed as text.

    Has someone a solution?

    I have tried to send the form data as an attachement (in the wizard), but

    the mail arrives everytime without the attachement.

    Still another question. Is it possible to make a contact selector in a

    browser form required?

    Greetz Luz

  • Hi Lucian,

    I am not sure I can reproduce the behavior you are seeing. When I display the form that contains the Contact Selector in the browser and then submit that form via e-mail, in the Preview Pane of Outlook 2007 I don't see a blank image - there just does not appear to be anything there. However, when I actually open that form I see the Contact Selector control - is this what you are seeing or do you actually see a "blank image" of the Contact Selector control?

    Regarding how to make this field "required" - try this:

    - Remove the "Submit" functionality from the Toolbar (this is an option under Submit Options)

    - Add your own button to the form and set its action to Submit

    - Add Conditional Formatting to the button such that if the DisplayName field from the Contact Selector group is blank, the Submit button is disabled.


  • Hi Lucian,

    One additional comment: if you are indeed seeing the same behavior as I, then this is expected. For security reasons, Active content (i.e. ActiveX controls, and the Contact Selector is an ActiveX control) is blocked in the Outlook Preview Pane.


  • Hi,

    First, is there any way to limit the Contact Selector options to members of a single SharePoint group or AD group?

    And second, can I limit the control so the user can only select a single person?


  • Hace unos días estaba trabajando con un formulario en InfoPath que publicaba a una biblioteca dentro...

  • Hi,

    I am looking into your question of limiting the Contact Selector options to members of a single SharePoint or AD group; however, in regard to your question of limiting the control so only one user can be selected - you would need to use custom code on the control to perform a "count" of the repeating node. If there is more than one, then throw an error. Here is some sample code:

    ** NOTE: "group1" is the parent node of the "Person" repeating node. **

    public void group1_Validating(object sender, XmlValidatingEventArgs e)


    if (e.Operation == XmlOperation.Insert)


          if (e.Site.SelectChildren(XPathNodeType.Element).Count > 1)


                e.ReportError(e.Site, false, "User Selection Error!", "Only 1 user can be selected!");




    What this will do is add an error to the errors collection if the contact selector contains more than one entry. Because an error is added to the errors collection, the form cannot be submitted. So although this will still “allow” more than one user to be selected, it does present an error to the user.

  • Hi Scallin,

    The Contact Selector control is technically not an InfoPath only control so I needed to get a hold of the proper folks to confirm: the Contact Selector control does not have the native ability to restrict users to a single SharePoint or AD group.

    I would think though that you could write code on the "Validating" event to perform you own validation of what group the selected user is a part of.


  • Hi,

    Thanks for the great article, would probably save me lot of work.

    I have got the control working on my browser form as per your article.  My form is submitting the data to a sharepoint form library, and all is well in that area too.  

    Now I need to do 2 things:

    First, I would like to promote the selected contact to a column in sharepoint library.  This is so that the column can be filtered by current user.  

    second, I would like to pre-fill the control with value that i get from AD using code.  Any comments on that ??  I can access full user details from AD, so the only problem is to fill it properly in the controls data structure.



Page 1 of 27 (398 items) 12345»