Using the Contact Selector Control

(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

Comments (398)

  1. "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

  2. infopath says:


    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,


  3. 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

  4. infopath says:

    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.



  5. char507 says:

    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?

  6. Scott Heim says:


    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.



  7. Lucian Foppa says:


    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

  8. Scott Heim says:

    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.


  9. Scott Heim says:

    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.


  10. scallin says:


    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?


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

  12. Scott Heim says:


    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.

  13. Scott Heim says:

    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.


  14. zafayar says:


    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.



  15. Scott Heim says:

    Hi Raj,

    InfoPath 2007 does not support promotion into a Person or Group field – what may work is to create another node in your data source (it does not need to appear on the view) and set the default value of this to either the Display Name or AccountId field and then promote this field. Obviously this will simply be a text data type and not a Person or Group field.

    Regarding how to populate the fields appropriately, you will need to set the value of the DisplayName and AccountId fields. The AccoundId is merely domainuser; however, in my testing it appears this is case-sensitive. As an example, the following does work for me:


    But what appeared in the Display Name field was: "FirstName LastName <domainuser>"

    Whereas when I changed this to:


    Then the only thing that appeared in the Display Name field was: "FirstName LastName"

    I would suggest for testing that you simply drag the Person group to your view as a Repeating Section with Controls, select a value using the Contact Selector control and you will see how these fields are populated.


  16. says:


    "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!"

    There is only one problem with this great idea and that is that ActiveX controls are not supported in template parts. At least that is what it says when I try.


  17. Scott Heim says:

    Hi Andy,

    My apologies for the confusion – what I was referring to was the process of creating the data structure needed for the Contact Selector control. You are correct – ActiveX controls are not supported but you can create the data structure so that all you need to do is add that template part to your new XSN and bind the Contact Selector control to that data structure.


  18. zafayar says:

    Hi Scott,

    Thanks for the reply,

    I figured out by trial and error on how to pre-populate the control, the same way that you mentioned.

    But still one of my problem remains.  What i need to do is perform a basic workflow on the submitted form.  Once the form is submitted, it is assigned to the user selected from the contact selector.  This part is done.  What i want to provide is the view to users so that they can only see the forms submitted to them.  I tried putting all possible values in the fileld (username, domainusername etc), but it still would not filter with [Me] or [Current User].  Is there any way to do this kind of filtering ???

    Thanks for your help,


  19. Scott Heim says:

    Hi Raj,

    Not trying to "pass the buck" on this but the filtering functionality is a feature of SharePoint – if this is not working as you need, you would probably be better served to post that question to one of the SharePoint groups.


  20. scott.lewis says:

    Is it possible to use the Contact Selector control on clients that only have InfoPath 2003 installed?  I have created a form in InfoPath 2007 and would like to allow users with only 2003 version to use it.  (Distribute/install the ActiveX control without having to install Office 2007?)

    -Thanks, Scott

  21. Scott Heim says:

    Hi Scott,

    This is not a supported scenario – the Contact Selector control requires some 2007 files hence your users will need to have Office/InfoPath 2007 installed on their machines.


  22. More often than not, while working on custom workflow LOB (Line of Business) applications, we usually

  23. More often than not, while working on custom workflow LOB (Line of Business) applications, we usually

  24. neoearth says:

    Very Cool Control! But…. 🙂

    How does one utilize more than one Contact Selector control on a form?

  25. Scott Heim says:

    Hi neoearth,

    Assuming you have followed the naming conventions in this post, you have a group node named: gpContactSelector under the "myFields" node. To utilize another Contact Selector control:

    – Add a new group node under myFields named, for example, gpContactSelectorNew

    – Expand the existing gpContactSelector node

    – Right-click on the Person repeating node and choose Reference

    – Select the new group node, gpContactSelectorNew, and click OK

    – You should now see the Person node under gpContactSelectorNew – simply drag gpContactSelectorNew to your view and select Contact Selector!


  26. brett.c says:

    Hi Scott,

    Following up on the discussion regarding adding more than one Contact Selector Control to a form, I have a form and am trying to:

    – Add more than one (2 specifically…lets call them csA and csB) CS ctrl to each form, and

    – Perform a "required field" validation against both of these

    I’ve tried to implement this logic by using the technique you discussed on March 15 (remove the default form Submit feature & control the submit through a custom submit button with some conditional formatting). However, it doesn’t work: when trying to make conditional formatting references to the 2 seperate DisplayName fields within the 2 seperate Person nodes of both the csA and csB contact selectors respectively, filling in *either* contact selector will cause the submit button to become enabled.

    In addition, we’ve tried other techniques, such as checking for fields (marked as required) associated with specific Person nodes, copying data to them using rules, and setting the default values to DisplayName node, amongst others. None of them seem to work (most of the form rules and field updates seem to trigger on submit, which is too late).

    Do you know, or can think of any way we can host more than one Contact Selector on a form *and* perform "required field" validation against both??

    Loving the blog, and thanks for your help in advance!

    Cheers, Brett

  27. Scott Heim says:

    Hi Brett,

    I am not sure I am seeing the same behavior as you – here is what I tested:

    – Added 2 CS controls as per my prior steps

    – Added a button control to the View

    – Added the following Conditional Formatting to the button to disable the control:

    DisplayName -> Is Blank (this points to DisplayName under group1) or

    DisplayName -> Is Blank (this points to DisplayName under group2)

    If you then choose "The Expression" from the first dropdown box, my Conditional Formatting looks like this:

    my:group1/my:Person/my:DisplayName = "" (or)

    my:group2/my:Person/my:DisplayName = ""

    Now, if I Preview this form and enter a name in CS1, the button remains disabled. However, once I add a name to CS2 the button becomes enabled.

    Am I doing something in error?


  28. brett.c says:

    Hi Scott,

    No, you’re doing it right, I’m an idiot! I just realised that the behaviour was not actually due to the contact selectors, but to something else I’d left in my overly complicated form from when I was trying to get it to work. When I replicated your test on a fresh form, it worked great!! Sorry I ever doubted! 🙂

    FYI, I’ve noticed that this technique will only work on the "first use" of the control; if you populate the control, and later clear it, required field validation will not be able to pick up the change, obviously because the DisplayName node still holds a value. It’s not easy to clean this up without reverting to custom code, is it?

    Thank you very much for you timely help and assistance! Now loving the InfoPath blog even more!!

    All best, Brett  🙂

  29. Scott Heim says:

    Hi Brett,

    Glad you were able to isolate the problem! In regard to what happens after you clear the user from the CS control, you can better see this by dragging the "Person" node to your View as well. When you enter a user in the CS control and click the button to validate the user, you will see the associated fields get filled in; however, when you simply clear that user from the CS control those fields do *not* get cleared until you validate the user. Now – at that point, not only do those fields get cleared the node gets removed entirely. So, to make this work you will need to modify the Conditional Formatting on the button:

    Display Name is blank (for the first CS) (or)

    (Choose The Expression) count(my:group1/my:Person) = 0 (or)

    Display Name is blank (for the second CS) (or)

    (Choose The Expression) count(my:group2/my:Person) = 0

    What this will do is disable the button when: either control is blank or once you delete the user and click the button to validate the user.

    Short of this, you would need to write code to see if anything else would work.


  30. The contact selector control in InfoPath 2007 is quite handy for users to select a person from active

  31. levy says:


    Thanks for the wonderful tips on the Contacts Selector. I have used a contacts selector on a form and it works fine.

    However, I need the form to be submitted to a document library with a name generated from the user’s name, and a link to the saved document to be sent to the person selected on the contacts.

    When using infopath, this works fine but when i publish the form and fill on the browser, it saves in the library but does not send e-mail.

    I am submitting the form using a rule that uses 2 data connections, 1 to submit to the library and 1 to e-mail.

    What could be the problem is not submitted to e-mail from the browser?

  32. infopath says:

    Hi levy,

    Keep in mind, when sending mail from a browser form it will be sent via the mail services setup on the server. Have you setup SMTP mail?

    If so, have you confirmed it is working? For example, can you add an "alert" to a list and actually get that mail?


  33. levy says:

    Hi Scott,

    SMTP is currently configured on the server

    e-mails/alerts are going through. i just added an alert and received the notification

  34. levy says:

    The data connection that sends the e-mail is set to "send only the active view ……". The summary after customizing is:

    Type: Submit Data

    E-mail Subject (expression): concat("http://enation2/SiteDirectory/HR/_layouts/formserver.aspx?XmlLocation=/SiteDirectory/HR/Investment%20Trust%20Fund/Monthly%20Contributions/&quot;, translate(MemberFullName, " ", "_"), ".xml&OpenIn=Browser")

    To (expression): DisplayName



    View Only

  35. infopath says:

    Seems like it should work – is there anything in your Application Event log or the SharePoint server logs or the SMTP service logs that would provide a clue?


  36. 環境: Microsoft Office SharePoint Server (MOSS) 2007 Visual Studio 2005 SharePoint Server 2007 SDK and

  37. 環境: Microsoft Office SharePoint Server (MOSS) 2007 Visual Studio 2005 SharePoint Server 2007 SDK and

  38. cfarkal says:

    Hi Scott,

    Question on resolving lastname, firstname in the contact selector.  I am populating this control via a database with a name and am having problems getting the name to resolve.  Even though the name should resolve it is only looking at the last name then automatically entering a semicolon –   lastname; firstname.  It is treating it as 2 different names.  I need this to resolve by populating the person’s name so the person submitting the form can see who it’s going to.

    I am using the GUI to design this browser form.  Please help!  


  39. infopath says:

    Hi cfarkal,

    As you have probably tested, it is not just when you programmatically set the name as: last, first – if you just type it in this way it does not resolve.

    The Contact Selector control is technically a SharePoint control and without debugging into the control, I am not sure why it does not like the name in this format. So – why not just format the name as: first last?

    Here is some sample code:

    XmlNamespaceManager ns = this.NamespaceManager;

    XPathNavigator xnDoc = this.MainDataSource.CreateNavigator();

    XPathNavigator xnCS = xnDoc.SelectSingleNode("/my:myFields/my:gpTasks/my:gpTask/my:gpContactSelector/my:Person/my:DisplayName", ns);

    string strName = "Heim, Scott";

    int intLoc = strName.IndexOf(",");

    string strFormattedName = strName.Substring(intLoc + 2) + ‘ ‘ + strName.Substring(0, intLoc);



  40. daska says:

    Hi Scott,

    Excellent article! In the last paragraph, you suggested we could create a template part using the Contact Selector but I get "ActiveX controls are not allowed in Template parts" error when I try to add contact selector to the form. Could you kindly elaborate on how we can add contact selector to the template part?



  41. infopath says:

    Hi Daska,

    Yes – I should have been more clear on this – my apologies. What I was referring to was creating a template part of the "data source" – this way you don’t have to keep recreating this each time. You can just add the template part containing the data source and just drag it to your View (it shows as a section.) Once there, just right-click on the Section choose Change To and choose Contact Selector!

    Saves a fair amount of time…


  42. daska says:

    Thanks for the quick response Scott! I really appreciate it. It works but now the problem is that entering a value in one control shows that value in other controls too. For example, if i use the template part multiple times on the same form, then entering the value in one control populates all the controls on the form. How can I resolve this? I will appreciate your feedback on this.

    Thank you very much.


  43. infopath says:

    Ah – now that is a bit different! 🙂

    To use multiple Contact Selector controls, you would need to do this:

    – Add the Template Part *once* to your View and change it to a Contact Selector control as noted before

    – To add another one:

        – In the Data Source Task Pane, right-click on myFields and choose Add

        – Enter a name (i.e. CS2) and set the Type to Group (NOT repeating)

        – Expand the Template Part data source, right-click on the top group (i.e. gpContactSelector) and choose Reference

        – Select the new CS2 group and click OK. The appropriate data structure is added for you! Now, just drag the new gpContactSelector to the View and choose Contact Selector control.


  44. daska says:

    Thank you very much Scott. It worked.



  45. daska says:

    Hi Scott

    I have a problem. I am publishing the InfoPath form (with contact selector control) in a SharePoint library. The value selected in the contact selector control does not appear in the SharePoint library. I have been trying to find the solution since morning but with no luck. While publishing ‘DisplayName’, i select ‘first’ function from the list of available functions. The ‘DisplayName’ property is created in the library but the value does not show. Any ideas?



  46. infopath says:

    Hi Daska,

    That’s odd – this works perfectly for me. In fact, I added both "Display Name" and "Account Id" as promoted columns and I see both get populated when I submit or save the form to the library.

    For testing purposes, create a new form template with just one Contact Selector control and see if this works for you. If so, let me know what is different that is not working for you.


  47. daska says:

    Is there any possibility that this might be happening because I am not on a domain? I am using a virtual PC and I am not on a domain. I am logged in as a local machine admin.



  48. infopath says:

    Hi Daska,

    I am not sure – that may be the cause. I would test with just the form template created in this post just to be sure.


  49. jwstrat says:


    We are using the Contact Selector control on an InfoPath form that is being used as a Workflow Task form in a SharePoint 2007 workflow.   The portal users are members of an Active Directory group named "Portal Members" and this group is a member of a SharePoint Site Group.  The Contact Selector will allow the user to select anyone in the "Portal Members" group but unless the person selected is in the "All People" list on the portal they don’t actually get assigned to the workflow task.   I’m not sure if this is an InfoPath problem or a Workflow problem – any insight would be greatly apprceiated.

    Thank you,


  50. infopath says:

    Hi Josh,

    Actually this is a SharePoint control – I would suggest starting with that group. It may be a workflow issue but I am not sure.


  51. Body: Para que septiembre no se vaya en blanco, aqui les comparto algo que nos anduvo dando algunos dolores

  52. Para que septiembre no se vaya en blanco, aqui les comparto algo que nos anduvo dando algunos dolores

  53. marci737 says:

    Hi all!

    I made a contact selector. I want to select one ore more users, get their DisplayName and AccountID.

    So far ok, but now, I want to add a CheckBox and a Dropdownlist to each selected Person. So I want to extend my contact selector so, that I can fill these extra fields. If I add these controls to the Contact Selector, these fields are dimmed, I cannot type in or select any values.

    How can I do this using an other way?

  54. infopath says:

    Hi marci737,

    Assuming you are trying to achieve a scenario where you can "select" multiple users, here is one way to get this to work:

    – Modify your data source so that "group" for the Contact Selector control is under another "repeating group." For instance, here is how this Blog sample was designed:

    – gpContactSelector (non-repeating group)

        – Person (repeating group)

             – DisplayName

             – AccountId

             – AccountType

    You could modify it like this:

    – NewRepeatingGroup (repeating group)

        – gpContactSelector (original non-repeating group)

             – Person (original repeating group)

                  – Etc.

    Then, under the new "NewRepeatingGroup" you would have your checkbox and dropdown list nodes. You could then drag the NewRepeatingGroup to your View and choose Repeating Table. This will add the Contact Selector fields as an "Optional Section." Just delete this and drag the "gpContactSelector" group to that first column and choose Contact Selector from the control choices.

    Now, when you Preview this form you can enter a name in the Contact Selector control, validate it and the check box and dropdown lists are still available!

    I hope this helps…


  55. marci737 says:


    Thanx for the feedback, but it is not exactly what I wanted to do. 🙁

    So: I have a contact selector. I fill this with names for example: marci737;infopath;chuck;teddy. The names are separated with ";". When I validate them, I want them to appear in a new repeating table so:



















    This would be the input for the next form.

  56. infopath says:

    Hi marci737,

    There is no way in the UI to accomplish this – you will need to write custom code to accomplish what you are asking.


  57. caseycase says:

    This works great for me – however, how do I set the default to be the current user?  I know where to do this… DisplayName, right click properties, default.  I just don’t the formula or the value to put in there.

  58. infopath says:

    Hi caseycase,

    I am assuming that not only do you want to have a default user specified but that you also want that name "resolved" as if you clicked the "Check Names" button on the Contact Selector control – correct? If so, there are a few things you will need to do for this to work.

    Clicking the Check Names button calls SharePoint’s "people.asmx" web service to resolve the name. So in order for us to do this automatically, we will need to add this web service as a data connection, set the appropriate queryFields and then execute the connection. Here are the steps you will need to follow:

    – Add a web service "receive" data connection to the "people.asmx" web service to your form template. NOTE: Make sure you uncheck the option to automatically get the data when the form loads.

        – The URL for this will be something like this: http://server/_vti_bin/people.asmx

        – Select the ResolvePrincipals method

        – Complete the wizard

    – From the Tools menu choose Form Options -> Open and Save

    – Click the Rules button

    – Click Add Action

        – Set a field’s value

        – The field is named "string" from the ResolvePrincipals queryFields

        – The value will be the "DisplayName" field from your Contact Selector data source (the default value for this will be domainusername)

    – Click Add Action

        – Set a field’s value

        – The field is named "principalType" from the ResolvePrincipals queryFields

        – Copy and paste this as the value: User SecurityGroup SharePointGroup DistributionList

    – Click Add Action

        – Query using a data connection

        – Data connection: ResolvePrincipals

    – Click Add Action

        – Set a field’s value

        – The field will be the DisplayName field from your Contact Selector data source

        – The value will be the DisplayName field from the "dataFields" of your ResolvePrincipals data source

    – Repeat the above action to set the following fields:

        – AccountId from Contact Selector equals AccountName from ResolvePrincipals dataFields

        – AccountType from Contact Selector equals PrincipalType from ResolvePrincipals dataFields

    So now if you set the default value of the DisplayName field to domainuser, it should auto resolve when the form is opened.

    I hope this helps!


  59. caseycase says:

    Wow, lots of information here, thank you!  I followed your instructions exactly and everything you said was where it was supposed to be, very impressive.  

    It appears to be working by doing the user check, but how do I get the default value to read the Current User who is filling out the form?

  60. infopath says:

    Hi caseycase,

    Glad that helped!

    Try this:

    – Remove the hard-coded user name from the default value

    – Click the "fx" button

    – Click the Insert Function button

    – Select the All category

    – Scroll to the bottom of the Functions list and select userName

    – Click OK until you are back to your form

    – Test! 🙂


  61. caseycase says:

    That worked!  Thank you very much – thank you especially for responding so quickly.

  62. infopath says:

    Glad to help!


  63. infopath says:

    Hi arttu_123,

    In regard to your question of using the Contact Selector control in a Document Information Panel – I don’t know that I am seeing the same results. Here are the steps I followed:

    – Created a new Document Library named: ContactSelectorTest

    – Enabled the option: Allow management of content types

    – Added a new column to this library named: Responsibilities and set the data type to Person or Group

    – Clicked the Document Content Type and selected Document Information Panel settings

    – Clicked Create a new custom template

    – Reviewed the data source and it matched what you are seeing:








    – Published this back to my library as a Document Information Panel (default option)

    – Clicked New to create a new Word document

    – Entered my user name in the Contact Selector control and clicked the "Check Names" button – result: resolved my name

    – Clicked the Add people from Address Book button, entered a co-workers user name, clicked the Go button, selected that user, clicked Add and then OK – result: that user’s name was displayed in the Contact Selector control.

    Am I doing something differently than what you are trying to accomplish?


  64. thunderstorm says:


    Brilliant post, helped me loada already! 🙂

    Relly annoying that you can’t promote to a person or group field in SP however..

    So I wondered is there a way to get the actual email address instead of the account ID or display name? I think this would look better in a column instead of the account ID.. but is it possible? 🙂


  65. infopath says:

    Hi thunderstorm,

    The Contact Selector control will only be able to obtain the data for those fields that you see in the data source. You may be able to use the value returned in the AccountId field to query your Active Directory to return this information.

    The other possibility is if you have a configured profile database, pull the information from here as well.


  66. anca_accenture says:

    Hi Scott

    Very nice post here, helped me alot.

    I have the folowing issue: I’m trying to use Contact Selector on a Modification Form for my workflow.  When I want to add a new Contact on that form, it gives me the following error: "’my’ is an undeclared namespace: Line 1, Position 2" + StackTrace.



  67. infopath says:

    Hi Anca,

    Does the same error occur if you simply double-click (launch) the InfoPath form outside of your workflow? I just want to be sure this is not specific to your workflow process.

    In short, it sounds like you are maybe using code to reference one or more nodes and have not declared the appropriate namespace.


  68. anca_accenture says:

    Hi Scott,

    Sorry I was so brief in my last post.

    Basically I tried to deploy the form in a non workflow context, just publish the form and then test it. It works (both in infopath and browser) , so it’s not something strictly related to the form !

    In the stack trace I can see that AppendChild() is called and with that also NamespaceLookup() and that is where the exception gets thrown.

    I don’t really understand because the same methods are called when I test my form in a non workflow related environment, and it works.



  69. arttu_123 says:

    Hello Scott,

    Actually when creating a new document information panel for that content type, I’ve been editing the current template, instead of creating a new one, otherwise I’ve been doing the same as you – appearantly with different results.

    However, I followed your steps to the letter on our staging site, and everything worked flawlessly and the contact selector works properly. The same method did not work on our production site though.

    When I try to create a new custom template I get an error message that I self atleast cannot interpret:

    "InfoPath cannot open the following form: C:Documents and SettingsusernameLocal SettingsTemporary Internet FilesContent.MSOD60BC53.tmpcustomXsn.xsn"

    And in details:

    "The form definition (.xsf) file contains elements, attributes, or structures that are not valid.

    Error details:

    ‘list_’ is a duplicate key for the unique Identity Constraint ‘{}dataObjects_name_unique’.

    Line 155, Position 4



    I’m all baffled about this message and I’ve been trying to fix it myself.

    Oddly enough I’ve been having lot’s of problems with InfoPath when working directly with our production site and none when working with any other web application.

    So the main problem isn’t fixed yet though. I’ve been editing the current xsn template and manually added the contact selector control there and binding it to the Responsibilities data source. I can still type in some text to the text field and browse through the address book. But when I either try to click the ‘Check names’ or after cliking OK in the address book, nothing happends – nothing appears in the text field.

    I’d think that the contact selector would start working properly aswell if I could get that "Create new custom template" working. I just hope that it’s some small strange bug and not something with the whole web application.

    Thanks in advance,

    Sebastian Eriksson

  70. infopath says:

    Anca – have you added custom code to your form? Are you 100% sure this code gets executed in a non-workflow scenario?

    Sebastian – what happens if you create a new test document library and attempt to create a new custom template – do you still get the error? I am wondering if this is site or library specific?


  71. arttu_123 says:

    Hello Scott!

    Ah yes, it does actually work when I create a new document library in the same site. Well I guess this solves my problems then, a bit work to add all the columns and content types to the new library, but nothing too much. The cause of that error still eludes me though. But hey, all that matters is that it’s working now 🙂

    Thank you


  72. arttu_123 says:

    Hello again,

    I actually figured out why I kept getting that error message when trying to create a new custom template in a document library. One of my custom content types used in that document library uses two lookup colums which get the information from another list in my sharepoint site. For some reason when I create a new template, InfoPath sets the data source for those columns as a list named just "list_", and it only has a value @ID, nothing else.

    And when I had those two lookup columns in one content type they both used the dataObject name ‘list_’.. hence the "’list_’ is a duplicate key for the unique Identity Constraint" error. I can get it properly working when I remove the second lookup column from the content type and manually readjust the data source of the first lookup column after "Create a new custom column". Do you think this is a bug or just something with my site collection?

    In short: I have two sharepoint lists and one document library with a custom document content type that has lookup columns to fetch information from those lists. InfoPath sets the data source for these columns wrong, when trying to create a new DIP template for the document content type.

  73. anca_accenture says:

    Hello Scott,

    No, my form has no custom code in it. My form only has a contact selector configured as you described it here, and a Submit button.

    I designed this simple form to use it in order to reassign a task to another person in a workflow. So when I try to add a contact in the control it shows me that error.

    I’m sure it works in a non workflow context.



  74. infopath says:

    Sebastian – that is great to hear that a new library works. Like you, it is interesting as to why the original did not but at this point, it is probably not worth spending a lot of time trying to isolate the cause.

    arttu_123 – thank you for the update! I am not sure if this would be expected or not – if you would like to pursue this, I would suggest opening a support case and please provide us with the steps to reproduce the behavior. It sounds like it could be an issue so we should probably look into this further.

    anca_accenture – thank you for the additional information. Can you confirm something for me: if you remove the Contact Selector control from the form, it then works in your workflow?

    Thanks all,


  75. caseycase says:

    Hi Scott –

    I need help with throwing an error message to the user when they try to enter multiple contacts.  I read your blog entry where this was covered above – however, I am not sure where to put the code.  Would this be part of the Submit options?  I couldn’t find a place in there either.


  76. infopath says:

    Hi caseycase,

    The code shows where it goes:

    ** 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!");




    Using the sample from the post, "group1" is the parent node of the "Person" repeating node. So as you see in the code, there is a "Validating"event on group1. What you need to do is:

    – Display the Data Source Task Pane

    – Right-click on group1, select Programming and then choose Validating Event

    You will then get an empty event. Add the following code to that event:

    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!");




  77. caseycase says:

    Thanks, I will try it, right now this option is grayed out until I get the VSTA downloaded and I am unsuccessful in doing so, I keep getting redirected to all kinds of links.

    On another note, during form field promotion, I am trying to promote one of the fields in the gpContactSelector to an existing site column called Associate Name that will show Presence.  I am trying to merge the DisplayName into the Associate Name column and receive this error:

    "The data type of the selected site column does not match the data type of the field to promote" – I also tried AccountId and AccountType, none of them work.  

    Do you know a workaround?

  78. infopath says:

    Hi caseycase,

    Unfortunately I don’t know of a workaround other that what I suggested earlier in this blog – the difference is that field will simply be a text field containing the AccountId or DisplayName of the user, which means Presence will not be available.


  79. Para que septiembre no se vaya en blanco, aqui les comparto algo que nos anduvo dando algunos dolores…

  80. hwg_Maarten says:

    I added the Contact Selector web part to a browser form, and I can select users properly from the sharepoint hosted environment.

    However when I go to send an email using the contactSelector group as the data field, it tries sending to instead of the proper ad email address which is, am I pointing to the wrong part of the datasource or am I doing something wrong here?



  81. infopath says:

    Hi Maarten,

    When you select a user in the Contact Selector, is the name returned as first.lastname in the control?

    Also – drag that node onto your view as a Section with controls so you can see each node and make sure DisplayName and AccountId show the same information.


  82. kristina.fitzgerald says:

    Hello InfoPath Gurus,

    I am following the directions you outlined for caseycase above and the Contact Selector automatically populates with the resolved name to the current user when the form is opened (Perfect, thanks.). The problem I’m experiencing is when a user enters a new name and resolves it, the returned value is: <currentUser> <newName>, even if the current user value is cleared from the Contact Selector before the new name is entered. Is your solution above meant to allow for a different name to be entered (the traditional use of the Contact Selector) or does it limit the control to the current user with appended names? Thank you for any information you can provide. – K

  83. infopath says:

    Hi Kristina,

    I see what you are saying…sorry about that. Try these modifications:

    – Remove the userName() function from the DisplayName field

    – From the Tools menu choose Form Options -> Open and Save category

    – Click Rules (you should see one rule created above)

    – Click Modify

    – Click Add Action

        – Action: Set a field’s value

        – Field: Pick the DisplayName field from your main data source

        – Value: Click the "fx" button and insert the userName() function

    – Make sure this new action is the first item in the list of actions

    This will still populate the "default" value to be the user that opened the form but if the user enters a new value in the control, it now appears to resolve correctly.


  84. kristina.fitzgerald says:

    Hello Scott,

    Your solution seems to work fine until I apply the validation code that you supplied above for limiting the control to a single entry. Somehow the ResolvePrincipals method is incrementing the person count on the Contact Selector, and not showing the accurate count after the first person is removed and replaced. Is there a way to force the count back down to 0 when the field is cleared? Thanks again for all your help. – K

  85. infopath says:

    Hi Kristina,

    I don’t believe I am seeing the same behavior – here is what I tested:

    – Made the modifications noted above to the Rule on the Form Open

    – Added the code to insure only 1 user could be added

    – Launched the form – result: my user name is populated and resolved

    – Deleted myself from the Contact Selector and entered a co-workers name

    – Clicked the Check Names button – result: name is resolved and no error about the number of users

    Am I doing something different?


  86. kristina.fitzgerald says:

    I apologize Scott,

    Somehow I was applying the validation code to the “Person” group rather than the Contact Selector group. I was too quick to post. Sorry! 🙂 This is a great thread. Thank you for responding so quickly and thoroughly. InfoPath can be a bear for beginners, but it would be impossible without these forums. Thanks again. – K

  87. infopath says:

    No problem – I am glad it works for you!


  88. ing_marco says:


    I have problems when I try use CS with TNS name space.

    Do You know how fix it?

  89. infopath says:

    Hi ing_marco,

    A few more details would be helpful. What have you done so far, what error are you receiving, does this sample even work, etc.


  90. In part one I created an InfoPath form that employees could use to create a work schedule. Now I&#39;m

  91. rjburke says:

    Contact Selector works as described.  Excellent.  

    I have one issue: I need to be able to retrieved disabled AD accounts.  We have field workers that do not frequently login, the accounts become disabled based on our security policy.  Their Supervisors need to fill out forms on their behalf.  The disabled accounts do get imported into SharePoint User Profiles database.  Any thoughs?

  92. infopath says:

    Hi rjburke,

    You will probably be better served posting that question to a SharePoint Newsgroup.


  93. dtrodler says:

    Hello Scott,

    I have a problem using the contact selector control in DIP for a content type. The contact selector works fine when the DIP is generated from scratch using sharepoint content type management UI, but it doesn’t work when the DIP is modified from parent content type DIP.

    In my scenario I have a tree of content types going from very generic ones to very specific ones. Since the generic (parent) content type already contains some code and external data connections, I do not want to recreate the DIP for each child content type from scratch, but instead I just want to modify the parent content type DIP.

    Unfortunately, if the child content type contains a new field of user/group type and I follow instructions in your article to add the contact selector control, I can select a specified user but the value doesn’t bind. I think that the problem lies in the fact that the top level node is called UserInfo instead of Person. When the DIP is created from the scratch there must be some internal plumbing going on which resolves this issue.

  94. infopath says:

    Hi dtrodler,

    Correct – that repeating node must be called Person in order for this to work correctly.


  95. dtrodler says:

    Hello Scott,

    thanks for the prompt reply. Is there any workaround? The DIP schema is read-only and I cannot rename that node.

    I think that reusing DIP from parent content type in child content types is quite common scenario and it would be nice to know how to use the contact selector in this case.

    Can you give me some information how it is done when the DIP is generated from scratch in sharepoint UI? The contact selector works in this case even when the repeating node is called UserInfo . I guess that some modification of the DIP form source files would help. Is there any documentation on this?


  96. mmattson says:

    Hello Scott,

    When I type in a keyword and click Go I get: Search Failed. I have my Context.xml file pointing to my sharepoint site. We are currently using Microsoft Windows SharePoint Services 2.0 with InfoPath 2007. Any Ideas?


  97. dtrodler says:

    Hello Scott,

    I think I have found a workaround for the "non-binding contact selector in derived DIP" problem.

    1.  Create content type A and generate its DIP using sharepoint UI (click "create new custom template")

    2. Modify the DIP as desired by adding external data connections, code etc..

    3. Create content type B which derives from A and has an additional field of type user

    4. Create its DIP by modifying A content type DIP (in sharepoint UI click "edit this template" instead of "create new custom template")

    5. In Infopath designer select "Convert Main Data Source" to update the schema to match the B content type

    6. Place the contact selector control on the form and bind it to your user field. (to the group node above the repeating UserInfo node)

    7. Save the B DIP form source files to "BDIPfromParent" folder

    8. Go to sharepoint UI and generate DIP for content type B again, this time from scratch (by clicking "create new custom template") – this will generate DIP with working contact selector control (but unfortunately all A content type DIP design is lost)

    9. Save the source files of this DIP form to "BDIPfromScratch" folder

    10. Open the file view2.xsl which is the stylesheet for the document management fields from the BDIPfromScratch folder and locate the contact selector control node (clsid:61e40d31-993d-4777-8fa0-19ca59b6d0bb)

    11. Copy the entire param section of this node

    12. Open the view2.xsl file from the  BDIPfromParent folder and located the contact selector control

    13. Replace the param section with the copied section.

    14. Make sure that the namespace prefix used in individual parameters corresponds to the same namespace as in the BDIPfromScratch view2.xsl

    15 Open the resulting form (by opening the manifest file in infopath) and publish it as a DIP for the B content type – you should have a working contact selector with your parent content type DIP design preserved!


  98. infopath says:

    Hi Daniel,

    Glad you were able to get a workaround!


  99. mmattson says:

    Hello Scott,

    I sent a message yesterday. Here’s more information. We are in the process of upgrading to SharePoint 2007. We are currently using SharePoint Services 2.0. Followed the information above to build the contact selector control but It’s not making a data connection. The error I get is "Search Failed". I have administrator access to the site. I’ve tried it on a blank template, with the same results. Will this work with SharePoint Services 2.0 or do I need to wait until we upgrade? As a rookie the team blog has be very helpful!



  100. infopath says:

    Hi Mike,

    To be honest, I think this is new functionality to 3.0. I don’t have a 2.0 server to test at the moment…do you have the Contact Selector (may be called the People Picker) control in 2.0?


  101. mmattson says:

    Hi Scott,

    Thanks for the reply. We are using InfoPath 2007. I was able to set up the Contact Selector Control, but it doesn’t look like the custom data connection using context.xml file is working. In SharePoint 2.0 I don’t see a people picker control. Although, I can create a lookup field that pulls user information using the built-in functions. I have a SharePoint 3.0 server setup in the lab I’ll see if it works there…



  102. says:

    I’ve followed all the steps listed and the contact selector just displays Search Failed each time.  What else could I be doing wrong?

    Are there any reasons known why the search would fail?



  103. infopath says:

    Hi Liz,

    Where does it show the Search Failed? Also – you will want to make sure this works directly from SharePoint. Try these steps:

    – Create a new document library for Word

    – Add a new column to this library as a Person or Group column

    – Create a new document by clicking the New button and just save this to the library

    – Select the saved document and from the dropdown choose Edit Properties

    – You should now see the Person column you created – perform the same search you did using the Contact Selector control…what is the result?

    If it is still Search Failed then this is an issue with SharePoint and I don’t have enough knowledge in SharePoint to troubleshoot that issue.

    If it works – then did you specify the correct site URL in the Context.xml file?


  104. maldrak says:

    I’m getting the same error as anca_accenture.  I have an infopath form serving as a workflow modification form.  When I try to enter anything on the people picker, it pops up with "There has been an error while processing the form."  Checking the logs, it has "Exception Message: ‘my’ is an undeclared namespace. Line 1, position 2."

    This form is also the association and initiation form.  It works normally in both those cases.  It is only as a modification form that it causes this error.  Any ideas?

  105. infopath says:

    Hi maldrak,

    Unfortunately I don’t know what would be causing this behavior. I never tested these steps with workflow forms so you may want to post this question to a workflow forum or contact Product Support (for Office Workflow) for assistance.


  106. Arakazu says:

    Hello, I am Ara.

    I am trying to use the contact Selector AcitveX control on browser enabled Infopath form.

    I followed your steps, and pulished it to a form library on MOSS2007 wich "Enable this form to be filled out by using a browser" cheked. The I can’t open the form from the form library on SharePoint. Error says "Unknow error".

    Do you have any tips???

    Please help me.

  107. infopath says:

    Hi Ara,

    Are you able to successfully publish an InfoPath Form Template with, say, just a text box and open it in the browser? I would not think this is being caused by the Contact Selector control.


  108. Arakazu says:

    Hello Scott,

    Yes, I can publish this form to form library successfully. And if I delete the contact selector control, I can open my form from sharepoint.

    Thank you for your help.


  109. infopath says:

    Hi Ara,

    Have you followed the steps in this post exactly or are you creating your XSN from an external source (i.e. a schema file, database, etc.)?

    Not that it should not work but I have not experienced this issue when following the steps in this post.

    If you have indeed followed these exactly, please reproduce the error again and take a look at the SharePoint ULS logs to see if there is anything in there regarding the loading of your form. (NOTE: You may need to enable "Verbose logging" for the various Forms Services categories.)


  110. LISpeedyG says:

    Hi Scott,

    You folks really seem to have a great handle on InfoPath, Great example!

    I have a couple of questions on a similar topic.  And if you could find your way to answering, it would be appreciated:

    Background: Infopath 2007 (Browser enabled), Main Data + 2 Sharepoint Lists as secondary data connections, Submitted to Sharepoint 2007 Forms Library and Email

    1. I  have a DropDown List Box that is bound to one of the secondary SP List connections returning CoNames (approx 1600 in list).  This was used since I have not been able to find a search function that returns only a subset of the list names.  The list names are resolved rhatehr quickly and I can see all 1600 names in the drop-down.  However, once I select a name from the list Explorer usually gives a message that the "A script on this page is causing Internet Explorer to run slowly."  I am guessing that the large number of data is causing this message to appear.  I have checked off "never" on the Post back settings but it does not seem to have helped at all.  Additionally, once I have chosen a CoName several other text boxes are then assoriated to the CoName record, i.e., CoEmail etc..  And, as I tab across other fields I continue to get the same pop-up concernign the script activity.

    So, the questions for this:  a) Are there any other methods to serch a SP field (using wild cards) would be extreemly helpful. b) Is there a way to speed up the forms lookup process so that we do not get the pop-up displayed?

    2.  Once the form is filled out by the sending company with the above information it is then to be sent to the receiving company by email in order for them to continue filling out the remainder of the form.  So, I need to permanently "paste" the information retreived from the SP list into the form so that the receiving company cannot change it.  But the receiving company will fill out other parts of the form that relate to their activity on the topic.  Note that the receiving company is not to have access to the SP list but only the form.

    The questions here are: a) The form currently attached to the email curently requires UserName and Password to continue filling out the form.  Since, apparently the sencondary data connections are still active once the email is received by the receivign company.  Is there a way to "paste" the chosen company specifics so that the form does not need to be connected to the DB?

    b) Is ther a way to enable the form to be filled out by companies not using Outlook 2007?

    I know these are not simple questions.  But the real world applications are also not usually simple.  Any help would be appreciated.

    Thank You,


  111. infopath says:

    Hi Gus,

    In the future, please keep questions and comments specific to the post.

    1A: You would need to either write code behind InfoPath so you can send a custom CAML query or you can create a custom web service that uses a CAML query to return what you need – this way you don’t need code behind InfoPath.

    1B: Don’t return this many records – see 1A! 🙂

    2A: Make sure your data connections are not set to get the data when the form loads or you can look at caching the results for offline use. (Tools – Form Options – Offline.)

    2B: No – unless you use a browser form – then they would need access to the site where you are hosting the form.

    Like you have said, these are really not simple questions but I have provided "simple" answers. In reality, these will probably be more involved. You may want to poke around the InfoPath Newsgroups and see what others are doing or create a support incident where you can review this with an InfoPath Support Engineer.


  112. LISpeedyG says:

    Hi Scott,

    Thanks for the reply..  I am sorry for posting here, but it looked (at least to me) like similar topic.  Anyway, in the future I will try to find a closer fit.

    Thanks Again,


  113. says:

    does this ContactSelector activex works on browser-enabled InfoPath form?



  114. infopath says:

    Hi John,

    Yes – what you will probably have to do is set the Comptibility of your XSN to just InfoPath, add the Contact Selector control and then reset the Compatibility back to InfoPath and Forms Services.


  115. jborean says:

    Hi Scott,

    I am having a couple of problems.

    I followed every detail and when I tried searching for name it would pull up the names relevent to the search but then after selecting it the selector just goes inactive/blank.

    When I tried entering a name and checking it… it just goes inactive/blank.

    I started over, step by step, and noticed Step 3 "Drag the gpContactSelector Group to the View and select “Contact Selector” from the list of controls". When I try that there is no option for selecting the Contact Selector.

    I am trying to set up a form that will be used as you stated "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." So after the Supervisor is selected a email or task can be assigned.

    I am further hoping that the content of the selector can be referenced to assign a user role to grant access to conditional controls. And to send the user to a column in a SharePoint.

    Your help will be much appreciated.

    Best Regards,


  116. jborean says:

    Plus on Step 4 of Step 4 it says "

    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

    I do not see this option. There is however an "Automatically retrieve data when form is open" Option and you can select resource files and browse to the Context.xml file to include it in the template on the first screen for adding a Data Connection.



  117. infopath says:

    Hi Jason,

    The first thing I would suggest you verify is that the spelling/capitalization is correct in the data source for the Contact Selector control.

    Also – make sure the URL you reference in the XML file is valid for your site.

    Regarding your reference to step #4 – the steps you describe are correct: browse for the XML file and then make sure it gets included as a resource file.


  118. jborean says:

    Hi Scott,

    I had the following wrong:

    AccountId was AccountID

    and the binding was set to Person instead of gpContactSelector

    The option to select the Contact Selector resolved itself when the above were fixed.

    I am still having a challenge getting the form to reference the user selected for a user role. I am trying the 3 different values: DisplayName, AccountId and AccountType. We’ll see what happens… AccountId WORKED!

    Thanks… now all I need to do is figure out how to get the Army to give me a raise… lol!

  119. infopath says:

    Hi Jason,

    That is great to hear – congratulations!


  120. cgarcia says:

    Great article, thank you!

    I was able to get the Contact Selector working perfectly by following these steps.

    My problem is that I got the CS control working fine on the first form. I tried applying it to another (blank) form and got the "Search Failed" error when I click the "Go" button (this is after I’ve published to the SharePoint forms library). The control only works for the form where I first established it. The CS control is now available in the list of controls on my InfoPath client but fail when implemented (even when I set up the same data connection and Context.xml file as the first form). I’m not trying to tempate the control, just use it on a completly different form.

    Any ideas?

    I tried to read through all of the comments first, but I apologize if this question has already been asked. Thanks.


  121. infopath says:

    Hi cgarcia,

    The first thing I would check is your data source in the new form. Make sure the structure is correct and the node names EXACTLY match what I have in this post…including capitalization.


  122. トピック、バラバラ(?)ですみません。 ブログのツールのエラーで、なかなかアップできなくて、情報提供に少し焦っています。 なので、InfoPath ネタという訳ではないのですが。。。 &#160; でも、InfoPath

  123. Hi there,

    I have followed these steps to add the activeX control to my form, however whenever I try to resolve a name (either via searching or using the check name button), the whole control gets greyed out.

    When I use the search option, the search dialog does return a list of names as you’d expect but when I add a name and click OK, it gets greyed out.

    Do you have any idea what is causing this and how I can fix it.

    Regards – Martin Kearn

  124. infopath says:

    Hi Martin,

    Please verify the following:

    – The data source is designed exactly as I have in this post

    – The capitalization of the node names is exactly as I have in this post


  125. jagra says:

    Thanks for the great article and all explanations after it.

    I have a problem with this control: after a task is completed, if you open the task to review what was done, the information entered on contact selector fields (one or many) is lost. Is there a simple way to get it back and display it?

  126. infopath says:

    Hi jagra,

    Some questions: does it retain the selected user(s) if you follow what is in this sample? If so (as it does for me) then how have you implemented the control?


  127. FourthMusketeer says:

    Hi Scott.

    This blog has been very helpful.  By reviewing the information here I been able to add the Contact Selector control to my form, and also set up a second instance of the control on the form.  All is working great!

    Now I would like to filter / restrict the selections to AccountType=User.  Right now it is possible to select security groups and distribution lists, either by browsing from the finder or by typing it in directly.  I want to prevent that and display some type of appropriate message to the users.

    I’m not a programmer, so my ability to get too custom with code is somewhat limited.  However, any thoughts or suggestions you might have would be greatly appreciated.



  128. FourthMusketeer says:


    I forgot to mention that I am using the browser to render the form, not the InfoPath client.


  129. infopath says:

    Hi FourthMusketeer,

    I have been trying to develop sample code for this (there is no way to do this via the control, UI, etc.) but unfortunately I have not been successful in getting this to work.

    If I ever find a solution, I will be sure to post it here.


  130. k_luckyreddy says:

    Hi Scott,

    I am getting search failed error when I serach for a contact in Contact selector. User or person field works in my sharepoint site.

    I followed all the steps. I rechecked Spellings and Captilization.

    Should I publish the form to sharepoint for the contact selector to work.

    Any help is appreciated…


  131. infopath says:

    Hi k_luckyreddy,

    You should not have to publish the form template (XSN) for the Contact Selector control to work; however, for troubleshooting purposes this may be a good test.

    If the Contact Selector control still fails when being opened in the browser, check the server Application Event log and see if any errors around this issue are being written to the log.


  132. 晃晃悠悠 says:


  133. jagra says:


    Refering to a post on May 6, the contact picker shows only the first choice when someone opens the form after the first submit (on workflow task history). That is done by defining the default value = ItemMetadata/ows_accountId.

    When more then one person ou group is selected, the data is correctly sent to workflow but opening infopath form only shows the first user.

    Maybe we are doing something wrong 🙁

    Can you post an example of an ItemMetadata that works for multiple values in a ContactPicker?

  134. infopath says:

    Hi jagra,

    I am not sure I follow – can you successfully show multiple values (separate by a semi-colon) if you just open an InfoPath form with the Contact Selector control?

    Workflow issues are handled by a different team so I am not sure how you are getting this information to the Contact Selector control but as a test, I can successfully open an InfoPath form with the Contact Selector control, enter 2 names (again, separated by a semi-colcon), resolve those names and save it in the underlying XML.

    So maybe the question would be: is the InfoPath form being "saved"? If not, I am assuming you are reading the values from the ItemMetaData? If so, how is this being done?


  135. stephorn says:


    I am having some problems with what I thought would be a very simple application for the Contact Selector control.

    We have a MOSS Forms Library and on our form we would like for the person to be able to select whom to e-mail this form to.

    So, we have created the Contact Selector as described above.  Then we added a data connection to e-mail those people selected in the Contact Selector.

    The problem we are seeing is that when we select the Display Name – it attempts to send two e-mails one for the first name and the other for the last name.

    Then we switched to AccountID and that is sending an e-mail to

    Is there a way to use the Contact Selector to accomplish this task?  

    We have been looking at how to strip the domain from the AccountID setting but don’t know how to do that.

    Any Thoughts?

    Thanks for all the useful information,


  136. infopath says:

    Hi Andy,

    As you have probably seen, the user’s "e-mail" address is not one of the pieces of data that is returned by the Contact Selector control. However, you can achieve what you want using a couple of string manipulation functions: "concat" and "substring-after".

    Here are the sample steps:

    – Modify your e-mail submit connection

    – Click the "fx" button next to the "To" field

    – Basically what you need is the user id after the "" from the AccountId field. So to get this you would use the "substring-after" function.

        – Click Insert Function

        – Select the Text category

        – Double-click "substring-after"

        – Double-click the first argument to this function and select the "AccountId" node for the Contact Selector and click OK

        – Select the second argument to this function and replace it with this: ""

    – At this point, you should have this: substring-after(AccountId, "") What you need to do now is simply use the "concat" function to concatenate this with your e-mail domain

        – Place your cursor at the front of the current expression and enter this: concat(

        – Place your cursor at the very end of your expression and add this: , "")

    – Now your complete expression would look like this:

    concat(substring-after(AccountId, ""), "")

    (NOTE: You will need to replace "" with the appropriate e-mail domain for you.)

    – Click OK to get you back to the Data Connection Wizard

    I hope this helps!


  137. mehtavipulk says:

    Hi Scott,

    With reference to the post dated "10-Apr-2007" (regarding restricting Contact Selector control for user to select only 1 user), I have implemented the code given there but for the 1st time when i enter more than 1 user, the control gives the error (by marking the control RED). But when I remove all the users except 1, the control still persists with there error message.

    But when I remove all the users & then enter a single user, it works fine.

    Is there any modification that I need to make in that code?


    Vipul Mehta

  138. infopath says:

    Hi Vipul,

    After you remove the users, you need to validate the control again (i.e. click the Check Names button.) Just removing the additional names from the control itself does not actually remove them from the "Person" repeating node.

    To see this, temporarily drag the "Person" repeating node to your View as a Repeating Section with controls. Add your names and verify – result: you will see the added repeating sections. Now, just remove the additional names from the control – result: the repeating sections with those users are still there until you validate the names again.


  139. Yannis-C says:


    I’m encountering an issue when in the same form view I have the contact selector as well as a currency field with data format ‘euro Dutch (Belgium)’.

    When I fill in my currency field, I get the american format (10,000.50) instead of the desired Dutch Belgium format (10.000,50). When I refresh the form or change view and return back, the format is updated to the Dutch one.

    Does anyone know how to edit the locale for the contact selector control or any other workaround?

    I’v already set the locale to Dutch in the site’s regional settings, the form language and the currency field.

    Thank you in advance.


  140. SubbuZ says:


    I wondering how come no one had asked this question so far on the ‘siteUrl’ in the Context.xml?

    I have an InfoPath form designed to be used from InfoPath client. I’ve designed this form in a development environment. So the Context.xml contains the URL for development site collection.

    Now I’d like to package the InfoPath form to be deployed in multiple Farms (Staging, Testing, Production). I’ve Data Connection library to take care of all other secondary connections. For Context.xml, I coould not create a I would like deduce the ‘siteUrl’ in the Context.xml on the fly based on the site collection to which it is being deployed. Is there way to do it.



  141. infopath says:

    Hi Subbu,

    The only way I know of to do this would be to write code on the Loading event of the XSN that updates this value in that XML Resource File. Keep in mind, dynamic updates to Resource files do not persist once the form is closed so this code would need to run each time the form is opened.  Which of course means you would need to know this URL when you deploy those XSN files.


  142. Will Dieterich says:

    Here is a solution if you want to limit the list of names to a group of people and only allow one selection.  This has limited uses but if you just need the email of a person so you can send email to them from a sharepoint workflow this does it.

    First dump contact selector, use drop down list instead.  This makes it easy to limit to a single person.

    1) Create a sharepoint custom list, add 2 columns  for the persons.  First one a name(with presence) the second set the Show Field to Work Email.  Fill in person for the name and email.  Most of the time where you are limiting the list of people some office is doing it and a simple note reminds them to duplicate the information; or have a workflow do it.

    2) Create a data connection using the retreive info from list.  Make sure to select the two columns you created.

    3) Create a drop down list and link the new data source to it showing the name and the value as your email address.  

    4) Publish and make available the column.

    You can now use that column in sharepoint workflow as an email address.

  143. Will Dieterich says:

    Here is a solution if you want to limit the list of names to a group of people and only allow one selection.  This has limited uses but if you just need the email of a person so you can send email to them from a sharepoint workflow this does it.

    First dump contact selector, use drop down list instead.  This makes it easy to limit to a single person.

    1) Create a sharepoint custom list, add 2 columns  for the persons.  First one a name(with presence) the second set the Show Field to Work Email.  Fill in person for the name and email.  Most of the time where you are limiting the list of people some office is doing it and a simple note reminds them to duplicate the information; or have a workflow do it.

    2) Create a data connection using the retreive info from list.  Make sure to select the two columns you created.

    3) Create a drop down list and link the new data source to it showing the name and the value as your email address.  

    4) Publish and make available the column.

    You can now use that column in a sharepoint workflow as an email address.

  144. star12 says:

    Hi Scott,

    Very informative article! Thanks for sharing.

    What you outlined works great, when I tried. My requirement is to be able to select email id in the submit form, just like having the contact selector once the form is submitted. The idea is to allow the applicant to direct the form to the appropriate approver.

    Is there a way to do this?



  145. infopath says:

    Hi FK,

    As you have probably seen, the user’s e-mail address is not one of the pieces of information returned by the Contact Selector control. You can either use the UserProfileService.asmx web service (if you have profiles setup in your  database) or take a look at my reply on 6/16 on how you can do this by parsing the information returned by the Contact Selector control.


  146. star12 says:


    Thanks for your reply. But I am not able to use contact selector control itself in the submission part of the form. To let you know, I am fairly new to Infopath and may be contact selector is not the answer to my problem.

    What I am trying to do is allow the user to select to whom the form must be submitted(via email). And I was trying to use the contact selector to select the email id in submission, but with fail.

    Is there any other way to do this?



  147. infopath says:

    Hi FK,

    Here is what I am referring to:

    – I am assuming you have a Contact Selector control on your form template

    – As you have seen, this does not return the e-mail address of the user (there is no way to get that specific piece of informtion from the contact selector control.) However, once you select a user, one of the nodes that does get populated is the AccoundId node from the Contact Selector control. You can parse the information in this node to create the e-mail address…assuming you know the domain where the mail needs to go (i.e.


  148. star12 says:

    Got you . Works great now. Thanks for your quick response!

  149. jjackson999 says:

    Hi, i have tried to create  the Contact Selector Control but when i load the infopath form in IE it doesnt do anything ? I must be doing something wrong somewhere. can you help me ???



  150. jjackson999 says:

    Hi Scott,

    Please see below some more detail (same problem as someone else)

    I have checked the logs but no joy ?

    I am getting search failed error when I serach for a contact in Contact selector. User or person field works in my sharepoint site.

    I followed all the steps. I rechecked Spellings and Captilization.

    The only thng I can think of is that the server name is incorrect (i tried the SP server and the domain controller )

    <Context siteUrl="http://<servername>"/&gt;

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

    Any help is appreciated…

  151. infopath says:

    Hi jj,

    The server that you enter in the context file should not really come into play if you are displaying the forms in the browser.

    I am wondering if there is some type of permissions issue possibly occurring? I would suggest you start with a Netmon trace and see if this shows where it is failing. If not – you will probably need to open a support case so we can dig into this further for you.

    Here is the download site for Netmon:


  152. mehtavipulk says:


    I have a Contact Selector control on my InfoPath form. In the AD I have 3 accounts mydomainuser1, mydomainuser2 & mydomainuser3. The name of all the 3 users are Test User. I have a DL "My Users" which has all the above 3 users added to it. I then added this DL to my share point site with "Full Control" permission. Using the contact selector search box when I try to search for "Test User", I do not see any records filter. But when I explicitly add the above 3 accounts to the share point site & then filter using contact Search Box, I see all the above 3 accounts listed.

    Before adding the above 3 accounts to the share point site, when I check the account name (by clicking the "Check Name" button on the right side of the control) the contact selector control successfully validated it against AD.

    It seems that Contact Selector look up box is filters the users from the people list of the share point site.

    Can any body tell me where does the look up box filters the account from? AD OR People List of the Share point site?


    Vipul Mehta

  153. infopath says:

    Hi Vipul,

    Can you see if the same behavior occurs with the SharePoint People Picker control? To test this, navigate in SharePoint to a Permissions page where you can add a user or group. When you enter a user’s name or a group (as you are trying to do) this is using the People Picker control – does the same behavior occur here?



  154. amit4691 says:

    Hi Scott,

    I am having some issues with "Contact Selector Control" on multiple Infopath forms. I am using Infopath forms along with SharePoint workflow process. I have two Infopath forms; in the first form known as InitForm I added two "Contact Selector Controls" in which workflow-initiator will specify two participants for the workflow in the begining. In the second form known as RevForm, I added another two "Contact Selector Controls" in which workflow task-owner will specify two more task-owners on the fly. The second form will work as a modification form for the workflow.

    Now, the problem started with "Person" object when I converted both the forms into C# classes using xsd. I had to convert them into C# classes so that I could access them in the run time (I am using XML serialization/deserialization in the run time). Both the classes are in the same assembly, the compiler didn’t like "Person" object twice. I tried with different name for "Person" in one of the Infopath forms. Somehow "Contact Selector Control" did not like any other name for "Person" object.

    What is the best approach in order to use Contact Selector Control on multiple forms? How can I access the data in the run time? I really appreciate if you could provide some advice in this regard.    



  155. mehtavipulk says:

    Hi Scott,

    I tried the above steps with Share Point people picker (PP) & that too behaved in the same manner. The  PP successfully validated the account name but did not filtered it using the search box. Only after adding the account to the people list, the search box filtered out the account(s)

    Is there any other control in InfoPath 2007 very similar to Contact Selector?


    Vipul Mehta

  156. infopath says:

    Hi Vipul,

    If the SharePoint People Picker behaves the same way then this is not an issue with the Contact Selector control per sé and you would be best served to either post this query in a SharePoint blog or possibly even open a support incident with the SharePoint group to investigate this behavior. I am not a SharePoint expert so I won’t begin to guess <g> if this is expected or not, can it be changed, etc.

    Amit – I have never tried converting to C# classes with multiple Contact Selector controls on one form – this may not be possible but I am not sure without further investigation. If you need this researched soon you would probably be best served to open a support incident to look into this further as I am not sure when I could do this. However, in the interim you may also want to post a query to a workflow blog to see if there is a way to get to the data without having to convert to C# classes.


  157. Yannis-C says:

    Hello Scott,

    I’ve posted a month ago an issue I had in relation with the Contact Selector control which unfortunately I haven’t solved yet. So first of all accept my apologies for bothering you again with this. I’ll describe my problem a bit more accurately.

    1. I have a web-enabled form with a currency field.

    2. This currency field is of Data type: ‘Decimal (double)’, Format: ‘Currency’, ‘Dutch (Belgium)’ and with ‘Use a digit grouping symbol (.)’ checked.

    3. When opening the form in a browser, the field works fine.

    4. When adding the Contact Selector control to the form, things go bad, meaning that if I paste the following number ‘100.000.000,99’ in the field, I get an error message ‘Only numbers allowed’. (The same error message occurs also when you manually enter a number and then change one digit.).

    This error happens only when opening the form in a web browser and with the control included the form.

    If you have any idea how I can prevent this happening, I would be very grateful. This control is much too nice not to make use of it for such a ‘silly’ issue.

    Thank you in advance.

    Yannis Chaviaras

  158. infopath says:

    Hi Yannis,

    It seems I can reproduce this without even having the Contact Selector control on the form template. At any rate, we need to look into this further and see if this is a potential issue. Please open a support case with Microsoft so we can dig into this properly and work with the Product Group on this should it be necessary.



  159. Yannis-C says:

    Hi Scott,

    Thanks for you reply. A support case shall be opened asap.



  160. richiej says:

    Hi Scott,

    great blog. Just wondered if you knew of a way to apply validation to contact selectors on a browser only form?

    I have 3 CSs on my form and I want to ensure the user has entered people in each CS. So far all my playing about with the conditional formating has failed. Is there another way to achieve this?

    Many thanks

  161. infopath says:

    Hi rishiej,


    It is a bit challenging to "validate" whether or not a Contact Selector control has a value and here is why: the corresponding "Person" node does not get updated until you "validate" the name selected or entered in the control.  You can easily see this by adding the Person node as a Repeating Section with Controls and then enter a name in the Contact Selector…none of the nodes under Person get updated until you validate the user. And the reverse is also true – if you simply delete the name you entered, the Person node does not get removed until you "re-query" (validate) what you entered. So this makes creating a fool proof validation method difficult if not impossible.

    Now, with that said, if you can "train" your users to always validate (click the Check Names button) their changes, then something like this will work:

    Add 3 new nodes (datat type = Boolean) to the "myFields" node:




    Add Conditional Formatting (I am assuming to, say, a button – that was my test) that simply check if cs1Completed is equal to False or cs2Completed is equal to False or cs3Completed is equal to False then disable the button.

    Now, you will need to code to toggle those "csxCompleted" nodes. To do this you will add the "Changed" event to each Contact Selector group (not the Person node but the parent group for each Person node.)

    In each changed event, I have code like this:

    if (e.Operation == XmlOperation.Insert || e.Operation == XmlOperation.ValueChange)


        SetBooleanNode(e.Site, "cs1Completed");


    And this is my SetBooleanNode procedure:

    private void SetBooleanNode(XPathNavigator xnCS, string strNodeName)


        XmlNamespaceManager ns = this.NamespaceManager;

        XPathNavigator xnDoc = this.MainDataSource.CreateNavigator();

        XPathNavigator xnBoolean = xnDoc.SelectSingleNode("/my:myFields/my:" + strNodeName, ns);

        if (xnCS.SelectChildren(XPathNodeType.Element).Count == 0 || xnCS.SelectSingleNode("my:Person/my:AccountId", ns).Value == string.Empty)





    The reason we need to check the node count is if the user clears their entry and then clicks the Check Name button (which we want them to do <G>) then the entire Person node is removed.

    In my testing this appears to provide what you need; however, this is entirely contingent upon the user validating the name they entered or selected…even if the value is blank.

    I hope this helps!


  162. richiej says:

    Thanks Scott, works a treat (not fool proof but certainly the best way)

    thanks again

  163. BlueChan says:

    Hi Scott,

    I’ve just tried to print an infopath form with the contact selector control on it. But the contact selector doesn’t print. Any suggestions?

  164. infopath says:

    Hi BlueChan,

    The information you see in the Contact Selector control is actually stored in the three nodes below the "Person" repeating group – not the "box" you actually see on the Contact Selector. (You can see this by simply dragging the "Person" node to your View as a Repeating Section with Controls and Preview the form. Simply typing a name in the Contact Selector control does not populate anything until you "validate" the name you entered.) To achieve what you want you will need to create a separate "printing" view (simply a View for printing) and instead of using the Contact Selector control on this view you will use either the "AccountId" or "DisplayName" node to show the selected user.

    I hope this helps!


  165. .Net says:

    Using the Contact Selector Control

  166. simonliu says:

    Hello Scott,

    I am having some problems about Contact Selector control.

    We have a MOSS Forms Library and on our form we would like for the person to be able to select whom to e-mail this form to.

    So, we have created the Contact Selector as described above.  Then we added a data connection to e-mail those people selected in the Contact Selector.

    The problem we are seeing is that when we select multiple users, how can we get  emails form AD for those users?

    In our AD, user account ID has no relationship with user’s email address,  For example, we select two users (John Smith and Tom Smith) John Smith’e email is: and Tom Smith email is

    Any Thoughts?

    Thanks for all the useful information,

    Simon Liu

  167. simonliu says:

    Hello Scott,

    I am having some problems about Contact Selector control.

    We have a MOSS Forms Library and on our form we would like for the person to be able to select whom to e-mail this form to.

    So, we have created the Contact Selector as described above.  Then we added a data connection to e-mail those people selected in the Contact Selector.

    The problem we are seeing is that when we select multiple users, how can we get  emails form AD for those users?

    In our AD, user account ID has no relationship with user’s email address,  For example, we select two users (John Smith and Tom Smith) John Smith’e email is: and Tom Smith email is

    Any Thoughts?

    Thanks for all the useful information,

    Simon Liu

  168. sebastian54 says:

    Hello Scott,

    This post has been quiet helpful in implementing the CS control in my forms, then with using multiple controls on forms, etc.

    One question which I have yet to get a definitive answer to is whether there is a way to promote the CS field from a form to a person or group column in MOSS.

    I can promote as simple text, but I would like to do it so there we have presence and a hyperlink (ideally without code).

    Is there just no way of doing this?



  169. infopath says:

    Hi Sebastian,

    The only way I know of is to use code because there is no mechanism to promote to a "Person/Group" field from within InfoPath.


  170. Nick Gerold says:

    Hi Scott!

    Great article!

    I’m newby in IP, so, I’ve a problem (

    I’ve got an SP workflow and my Instantiation form with Contact Selector Control. I need to assigne task to the user selected from the contact selector.  But I don’t know how to do it. What value I should whrite in "taskProperties.AssignedTo"?

    I know there are 2 ways: 1. Use x-paths, 2. Convert form to C# classes using xsd.  But I still don’t know what value(DisplayName/AccountID/AccountType) i should use to assign task correctly.

    I need help.

    Thanks for all pieces of advice


  171. infopath says:

    Hi Nick,

    I am not a workflow expert so I don’t know that I will be able to help with this question – you may be better served posting to a SharePoint or Workflow blog to get the best advice.

    Now, with that said, here in InfoPath the question we get a lot is how to "promote" the user selected in the Contact Selector control to a "Person/Group" field in SharePoint. This is not possible out of the box and requires code – so…why am I telling you this? <g> In order to get this process to even work using code, I have to get the "SharePoint ID" of the selected user and pass this to the Person/Group field. So in the end, this *may* be what you need to do as well; however, I would encourage you to not spend much time on my suggestion as I really don’t know if this is the correct way to go. Post the same question to a SharePoint/Workflow blog to be sure you get the best advice.


  172. Nick Gerold says:

    Hi Scott!

    Thanks for your reply (esp for so soon)!

    Well, I found some, er, kind of solution of my problem , but… getting trouble whith Contact Selector Control. (

    I’m starting to create a new workflow by myself (before this I changed existing one) and when I’m trying to open the form I have "unknow error" message.

    It seems to me that I missed something important…

    Well, I think, I should reread your great blog more cearfully.

    Thanks again


  173. infopath says:

    Hi Nick,

    No problem – what I would suggest though in your new workflow test is to take the Contact Selector control out of the picture. Create the workflow without this control and make sure you can launch the form.


  174. brad.covell says:

    How do I add two contact selector controls to the same form? I tried adding a second one but when I create the data for it mainly the groups and fields, it says the name of the group already exists. So I cannot name the group Person again or have fields named DisplayName….

    Is this possible to do?


  175. infopath says:

    Hi Brad,

    Take a look at the May 22nd comment…this provides the steps.


  176. BlueChan says:


    I want to enter the text from the Contact selector text field into the search box that appears when you click the "To…" button. Is this possible?

  177. sebastian54 says:

    I just figured out a way to promote to a person or group field.  It only supports single values, but it will work.  Simply create to columns one text, the other a person or group.  Promote the "AccountId" to the text column, then with a simple SharePoint Designer workflow update the value in the person or group column to equal the value in the text column.  


  178. Nick Gerold says:

    Hi Scott!


    Well… Whithout Contact Selector my workflow works like a charm. So, now I’m trying to deploy a solution whithout this, using advice about mails and data sourses from your blog (thanks that guy how shared it, too). But it is temporary decision and I guess I’ll return to Contact Selector later ( .

    It is not scary for me to use code and in your reply about "SharePoint ID" I see a way.

    Thanks again,


  179. infopath says:


    Unfortunately I don’t know of any way to accomplish this – sorry.

    Nick – glad to hear you are making progress…so the question now would be: since you have a working workflow, what happens if you add the Contact Selector control? If it then produces an error, turn on Verbose Logging (Central Admin | Operations | Diagnostic Logging) for the various Forms Services categories and see if anything is logged that would provide additional details as to what is failing.


  180. ClaytonCobb says:

    I have added this new control, but my form will not render in the browser if the control is added to the form.  If I remove the control from the form surface itself, then the form will render, but once I add it, I get a strange "Unknown Error" in the browser…the form never even opens, and the "Loading Form" image stays in view, which I’ve never seen before.  All other errors I’ve seen with InfoPath actually showed themselves from the Forms Services interface, but this is an error shown in the browser itself (looks the same as when you get an access denied error).

    I get nothing in my logs and have no idea what is occurring.  When I test it in preview mode (I did add the XML file as a secondary data source), I am able to click "To" and search for names (this works), but when I click Add > Ok, my control grays out and shows no information in the box.  I have checked over the data structure syntax, and it looks correct.  The fact that it will retrieve users in the "To" interface tells me I did part of it right, but I can’t make heads or tails of the other errors.

  181. infopath says:

    Hi ClaytonCobb,

    The first thing I would suggest is to try a completely new form using only the steps I provided in this blog. NOTE: Make sure that field names and *capitalization* match what I have here. If this does not work and you still get the Unknown Error page then try these steps:

    1) Navigate to your Central Admin site

    2) Select the Operations tab

    3) In the Logging and Reporting section click Diagnostic Logging

    4) In the Event Throttling section, click the "Select a category" dropdown box

    5) Select the "All" category

    6) In the dropdown below the title "Least critical event to report to the trace log" choose Verbose (note this is not for the event log – only for the trace log)

    7) Click OK

    8) In the "Trace log" section make a note of the path to the log files

    9) Navigate to your site and complete the steps to recreate the error

    10) Navigate to the log files folder, click the "Date Modified" column header twice (to sort them with the latest log at the top) and open the newest log with a text editor, i.e. Notepad.

    11) Scroll to the bottom and work your way back up and see if there is anything logged that would help isolate the problem.


  182. ClaytonCobb says:

    Scott, I did exactly what you suggested on #1 by creating a new, blank form that has nothing except the steps in this blog entry, and I get the exact same errors.  I already have my diagnostic logging turned on but may not have it set to verbose, so I’ll go check.

  183. ClaytonCobb says:

    Don’t see any errors in the trace log, but I also notice that my Diagnostic Logging settings keep reverting back to null.  Is that normal?  I set to All/-/Verbose, hit OK, it takes me back to the Operations page, then I click on Diagnostic Logging, and all the pulldowns are set back to null.

  184. ClaytonCobb says:

    Sorry for the multiple posts, but I have a set of screenshots showing:

    1) The strange browser error when trying to open a new browser-enabled form with the Contact Selector (rest of form is blank)

    2) Design mode of the form that confirms the spelling and setup of the data elements – shows the items tab on the properties of the Contact Selector control

    3) Shot showing the form in Preview mode (rich client) and how the To: button works and can retrieve my name from AD

    4) Shot showing the form in Preview mode after selecting my name and hitting OK

    How can I post this?  I have them as 4 images in a zip file that is less than a Meg.

  185. infopath says:

    Hi ClaytonCobb,

    Try this for me:

    – Navigate to the same site where you are trying to use this form template

    – Create a new library (this is just for this test so what you call it is not important and you can just create a Document library)

    – From the Settings button choose Document Library Settings

    – Click Permissions for this document library

    – From the Actions button choose Edit Permissions

    – Click OK to the message

    – Click the New button

    – Enter a users name in the "Users/Groups" box and click the "Check Names" button…does this work?


  186. ClaytonCobb says:

    Yeah, my people pickers work everywhere, so that doesn’t seem to be a problem, but I have new info that should really lead me to a solution, but it hasn’t yet.

    I had a friend at MS send me a working form that already has this same Contact Selector added, and when I use his form, the Contact Selector works perfectly both in rich-client and browser form.  I just had to change the resource file and a few other things, but when I published it to the SAME library as my previous form, it rendered in the browser perfectly like you would expect.  I have been viewing each form side-by-side and cannot see any anomalies except that his form had the data elements inside the Person group set to "repeating," but yours aren’t repeating in this blog.  I changed mine to match, but the behavior didn’t change, so I don’t believe that’s an issue.

  187. infopath says:

    Hi ClaytonCobb,

    That is indeed interesting information. If you would, navigate to: C:Program FilesMicrosoft OfficeOffice12, right-click on the "ContactPicker.dll" file and choose Properties – what is the Size, Version and Date Modified properties on your file?


  188. cewe says:

    Hi Scott,

       I have been trying to get the Contact Selector to work for 2 days now but it still would not work. I followed your steps exactly and repeatedly doing it to make sure I did not make any mistakes. However, when I tested my form, it always showed search failed. I am wondering that it may have to do with the server that URL that I used because I’m unsure of it.


    Thank you


  189. infopath says:

    Hi cewe,

    Try these steps please:

    – Navigate to the same site where you are trying to use this form template with the Contact Selector control

    – Create a new library (this is just for this test so what you call it is not important and you can just create a Document library)

    – From the Settings button choose Document Library Settings

    – Click Permissions for this document library

    – From the Actions button choose Edit Permissions

    – Click OK to the message

    – Click the New button

    – Enter a users name in the "Users/Groups" box and click the "Check Names" button…does this work?


  190. cewe says:

    Hi Scott,

       Yes, it works. Why do you want me to test this? Is it to test if the sharepoint’s directory is working?



  191. infopath says:

    Hi cewe,

    Many times when I have seen the Contact Selector control display Search Failed that you will get the same error when using the People Picker control in SharePoint – so I wanted to see if this was isolated to the Contact Selector control or happened elsewhere as well.

    What is the exact URL you used to publish the XSN?


  192. melmo says:

    Hi Scott

    Thanks for a great post and very helpful comments.

    I am using a contact selector in an Infopath form which will retrieve a users contact details when they enter their name. We do not store these details in AD, so this is a web service look up to another database.

    I have entered some rules which are set in the data source on the group containing the Person repeating group.

    These rules take the accountID from the contact selector and pass them into a query in the web service. It then populates several fields with the results of the query.

    This works perfectly in Preview mode but does not work when the form is published to SharePoint  Forms Services.

    It appears that when you enter a name and click the check button – the rules fire immediately – that is, before the name has been validated against AD and therefore before the AccountID is known.

    Any ideas on how I can get these rules to fire only when the name has been vaildated?

    Many thanks

  193. infopath says:

    Hi melmo,

    I believe your best option to accomplish what you need would be to write code to execute what you want and when you want it to execute.

    There is some sample code here in the comments for other issues – let me know if you need more help!


  194. melmo says:

    Thanks Scott

    I was thinking code but that didn’t seem as straightforward as I’d hoped. ( was helpful although they seem to be using a changed event rather than validating)

    I have managed to get my rules firing correctly when they were placed on the AccountID data source. I had tried this about 6 wks ago – but the rules didn’t fire in InfoPath preview so I never imagined they would fire in the browser!!

    Obviously the contact selector behaves quite differently depending on whether you are using it in the native InfoPath or publishing to the web.


  195. says:

    I have used SharePoint Designer in creating this workflow. I have used one infopath form and publised it to a SharePoint Library so that after filling it, users can submit. In this form , i have used a contact selector control named "Participants" so that user can write the name of participants.

    I want mail should go to each and every participant (Whose names user write in Contact Selector Control). Well contact selector does have the functionality of sending the mails by reading the user’s names and email addresses from active directory but it is sending only to the first person (among the names which i write in that control).

    While publishing the form when we map Infopath fields to sharePoint library, there come some options when i click on "AccountId", options are "first", "last", "count", "merge".

    When i click on first and publish the form then it sends mail only to the person whose name appears first on the contact selector control. If i selecet "last" then it sends mail only to the person whose name appears last on the contact selector control. On count it gives a integer value specifying the number of users in that control. When i use merge then it just merge all the names but does not send mail.

    I am not getting how to send mails to all the participants. Its really very urgent. Plz help



  196. infopath says:

    Hi Mel – glad to hear you have it working!

    Hi Ginni…I may have an option for you but with these steps I am making an assumption: when you select a user in the Contact Selector control, the AccountId field would display that user as: domainuser.

    Try these steps:

    1) Add a new node to your data source named: emailList (you do not need to add this to your View unless you just want to, for testing purposes, see it is getting populated correctly.)

    2) Right-click on the new "emailList" node and choose Properies

    3) Click the "fx" button for the Default Value property

    4) Click the Edit XPath check box to enable this option

    5) Copy and paste this expression into the Formula box:

    xdMath:Eval(xdMath:Eval(../my:group1/my:Person, ‘concat(substring-after(my:AccountId, ""), "; ")’), "..")

    6) Click the Verify Formula button and assuming there are no errors, click OK until you are back to your View.

    7) Add (or select) a couple of users in the Contact Selector control and if you added the "emailList" node to your View, you should see just those users in that box separated by a semi-colon

    8) Use the "emailList" field as the "To" option for your e-mail submit data connection

    NOTE: What the expression above is doing is getting each value in the "AccountId" field, parsing it to return just the name after the "" (i.e. domainuser) and then concatenating a semi-colon after each entry. So in short, this is building a semi-colon delimited list of the user names you have selected, which can then be used for your e-mail data connection!

    I hope this helps!


  197. cewe says:

    Hi Scott,

       Here is my exact XSN:

    http://<servername>/test/Infopath Forms/Forms/template.xsn

    Thank you


  198. infopath says:

    Hi cewe,

    OK – I may have missed something in your previous post: where are you adding this URL: http://servername/_vti_bin/UserProfileService.asmx ?

    Also – where are you seeing Search Failed? Is this when you click the "To" button and search for a name? Are you opening the form in the InfoPath client or in the browser?

    It sounds like you entered that URL in the "Context.xml" file – if this is the case, then you need to modify that URL to either: http://servername or http://servername/site (if "test" is indeed a subsite.)


  199. Giny says:

    Thanks a lot Scott. Its working now but one issue is there. That above infopath code is assigning one extra task. I mean if i am entring names of 4 participants then on start of workflow, in workflow details, it shows the task assgined to respective users like :

    AAA            Collecting Data

    BBB            Collecting Data

    CCC           Collecting Data

    DDD           Collecting Data

                     Collecting Data

    But it is assigning one extra task, without any name. I am not getting from where this extra task is comig where namefield is blank.(AAA, BBB are just names of participants)



  200. infopath says:

    Hi Ginni,

    I am not sure what code you are referring to? If this was specifically workflow code, you may need to post this issue in a workflow blog.


  201. Rimpy says:

    Hi Scott

    I have not used any code, i am using sharePoint Designer. I have just wriiten that formula in the infopath form text box control which u gave me to send mail to multiple people through contact selector control.

    That formula is working perfectly. It is sending mails to multiple people but creating one extra task as mentioned in my last comment.

    When i don t use this formula, then it does not create extra task but also at the same time sends mail to only one single person.



  202. infopath says:

    Hi Ginni,

    I don’t see how just adding that expression to a control would cause an additional (blank) task to be created. Do you have any code that creates those tasks? If so – how is that being accomplished? Is it looking at the names in this textbox to determine how many tasks to create?


  203. says:

    Hi Scott,

    I have not used any code. I am just using SharePoint Designer. In that, i have set "task assigned" field to this text box and it is assigning tasks to all those people whose names appear in this text box. It is sending mails too but also creating one extra task with a blank name.


  204. says:

    Hi Scott

    I want to ask one more think. Is there a way of resolving the names in the contact selector control by just hitting the enter key rather than pressing the check names button?


  205. says:

    Sorry its not think, its thing

  206. infopath says:

    Hi Ginni,

    I am not sure why SharePoint Designer would be adding an additional blank row like that – I wonder if it is because it interprets the trailing ";" as a new entry?

    If you want, try changing the expression that concatenates the values to this (this is still based on the sample here so field names, paths, etc. would still need to be verified):

    substring(xdMath:Eval(xdMath:Eval(../my:attendees/my:attendee, ‘concat(my:attendeeEmail, ";")’), ".."), 1, string-length(xdMath:Eval(xdMath:Eval(../my:attendees/my:attendee, ‘concat(my:attendeeEmail, ";")’), "..")) – 1)

    All this really does is remove the trailing ";" from the concatenated list of values.

    In regard to the Contact Selector question, the only way to validate a name is to:

    – Click the "Check Names" button

    – Tab to the "Check Names" button after entering a name and then you can use the Space bar

    – Use the "To" button where the Enter key will work to perform the search and the selection.


  207. says:

    Thanks a ton Scott. Its working great. I am very grateful to you.

  208. infopath says:

    Excellent! I am glad to hear it works as you need Ginni…

    Take care,


  209. ClaytonCobb says:


    In reference to our exchange back on Oct 9th, I have the information you requested regarding the properties of my ContactSelector.dll:

    Size: 187 KB

    Version: 12.0.6211.1000

    Date Modified: 8/24/2007 2:36 AM

    I’m still baffled as to how a form that someone sent me works fine (after tweaking the settings to match my environment), yet no form I create myself following the instructions will work.  You would think that through deductive reasoning, I’d be able to find the missing link or errant variable, but I see no differences at all.

  210. ClaytonCobb says:


    Disregard it all.  Using the working form and my non-working forms, I slowly ate away at the differences and kept breaking the good form one piece at a time until I narrowed it down to the final variable, and it truly was just the thing you told me to do at the beginning.

    No matter how many times I looked at the syntax of the XML fields, I never noticed that the "d" in "AccountId" was capitalized in my forms but not in your write-up (nor in the good form).  I guess the capital "I" kept throwing me off into thinking the "d" was also capitalized, but oh well.  The moment I changed that one character, it all started working.  I am now making some nice workflows using this (using the AccountID element) and will be changing many of my other nice forms to use this feature instead of having to use custom contact lists with drop-downs.

    Thanks for all the help.  Now, I wish I could delete all the previous posts except the first one!  =P

  211. infopath says:

    Hi ClaytonCobb,

    I am very glad to hear everything is working now! (It’s always the little things…isn’t it? <g>)

    Take care,


  212. cheshirefury says:

    Hi Scott

    I have spent a great deal of time reading though this Blog and its replies(which I must say has be overwhelmingly helpful).


    I’m having a few little issue I’m hoping its a easy fix or at least you can point me in the right direction.

    I have a Browser enabled InfoPath form with the contact selector working on it. This form submits to a list in SharePoint site but its unable to properly receive the data from the contact selector as it needs a format of 1#;JohnSmith or 32#;JaneSmith for it to be submitted to a list.

    I can concat  the info I receive from the Contact selector so i can submit to the list. But I don’t know how to get the ID to submit to the site Or is there a easer way to submit to the list and I’m going about this all wrong.

  213. infopath says:

    Hi cheshirefury,

    If you are just submitting new records to a SharePoint list then you should not need the ID. Have you seen this post:

    Now if you need to also edit/delete items from a SharePoint list you will need to use code and in the above post (you will need to review the comments) there is sample code to perform edits and deletes.


  214. NohaMohsen says:

    Hi Scott,

    Really a great post and comments…

    But I have 2 questions:

    1)What if i need this contact selector to connect to an active directory(not to the sharepoint active directory) what shall i do??is their any changes that i can do to the context file or even add a data connection to the data connection library??(in this case i will use a web service and put the url of that web service in the data connection library)

    2)second what if i want it to display the email,and the email can’t be formulated from the display name?? and can we display that mail instead of the displayname field??

    I will be greatful if you answered my questions.

  215. infopath says:

    Hi NohaMohsen,

    There is not a way to change where the Contact Selector control queries its data so there are a couple of options:

    1) Write your own code behind InfoPath or in a web service to query Active Directory

    2) If you have Microsoft Office SharePoint Server (MOSS) you could look at using the "Profile Database" and you can pull information from your AD into the profile database. Now this would not change how you use the Contact Selector control but what you could do is use that control to find/make a selection and then pass that user account to the "User Profile Service" (MOSS web service) to return information about that user…including their e-mail.

    In regard to displaying the e-mail – as you have seen this is not a property that is returned in the Contact Selector data. So you can use the Profile database as noted above or – if your e-mail addresses are consistent (i.e. then you can parse what is returned by the Contact Selector control and constuct the e-mail address. (For more information on this option, take a look at the June 16th response I provided.)


  216. cheshirefury says:

    Cheers Scott

    There is other reason im submitting via the code one of the reason’s is that i am having a lot less issues and more control on the form doing it this way.

    ATM its looking as though i wont me able to avoid doing it the code way. Is there still a way to submit if i do it the "code" way.

  217. infopath says:

    Hi cheshirefury,

    I am not sure I follow your question: are you asking if there is a way to submit to a list via code? If so – then yes and just take a look at the prior post I mentioned.


  218. NohaMohsen says:

    Hi scott,

    Thanks for the quick reply,and i did the email part…

    But regarding the AD part,how shall i implement that??I only have an event for the value changed and no other events….how can i handle the "Go button " present in the custom contact that does the search??

    If you have a sample code for that ,that will be great.


  219. cheshirefury says:

    Sorry Scott for the confusion.

    Im only looking for a way to submit the data from the Contact Selector Control to a "assigned to" list column via code.

    I have looked though the coments on this page and

    But im still missing what im after. I will check though the comments again and see if i can find it.

    Sorry for all the hassle it just i have been looking for a solution to this for a while now.

  220. infopath says:

    Hi NohaMohsen,

    If you want to use code to query Active Directory from the Contact Selector control, you can use the "Changed" event for the "Person" node. Here is some sample code:

    NOTE: You will need to add the following "using" statement (and reference if it is not already there)

    using System.DirectoryServices;

    public void Person_Changed(object sender, XmlEventArgs e)


               if (e.Operation == XmlOperation.ValueChange || e.Operation == XmlOperation.Insert)


                   //Create a NamespaceManager object

                   XmlNamespaceManager ns = this.NamespaceManager;

                   //Create an XPathNavigator object for the main DOM

                   XPathNavigator docXN = this.MainDataSource.CreateNavigator();

                   //Create a string variable to store the selected users "AccountId"

                   string userName = docXN.SelectSingleNode("/my:myFields/my:gp1/my:Person/my:AccountId", ns).Value;

                   //For AD, using the "samaccountname" we just want the login name so parse that value

                   userName = userName.Substring(userName.IndexOf("\") + 1);

                   //Create a new AD SearchResult object using a DirectorySearcher object and passing it

                   //the userName value

                   SearchResult result = new DirectorySearcher("(samaccountname=" + userName + ")").FindOne();

                   //Insure we found a user

                   if (result == null)


                       MessageBox.Show("Error finding user: " + userName);






                           //Create a new AD DirectoryEntry object using the GetDirectoryEntry method

                           DirectoryEntry employee = result.GetDirectoryEntry();

                           //Get the user’s full name by calling the displayName property

                           string FullName = employee.Properties["displayName"].Value.ToString();

                           //The following returns the manager’s name and additional AD info – so we will

                           //parse this to get just the name

                           string ManagerName = employee.Properties["manager"].Value.ToString().Substring(3, employee.Properties["manager"].Value.ToString().IndexOf(",") – 3);

                           //Get the user’s location

                           string strLocation = employee.Properties["physicalDeliveryOfficeName"].Value.ToString();

                           //Get the user’s title

                           string strTitle = employee.Properties["Title"].Value.ToString();


                       catch (Exception ex)





                   result = null;



  221. infopath says:

    Hi cheshirefury,

    Ah – this helps…submitting to the "Assigned To" column is different. First of all, the name of the column is: AssignedTo and what you send to this column is the SharePoint "User ID", a numeric value.

    So when I, say, want to submit to the Tasks list (which has an Assigned To columnn) I submit a value of: 1 and this shows as: Scott Heim.

    So the key to this is you need to get the SharePoint User ID for the user selected in the Contact Selector control and then send that value to the Assigned To column. You can easily do this with a custom web service on your server that takes the site and selected user as parameters and then simply call: web.AllUsers[passedInUserName] – as this will return the User Id.

    Here is a sample web method:


       public int GetUserID(string strSite, string strDomainUser)


           if (strDomainUser != "")


               SPSite site = new SPSite(strSite);

               SPWeb web = site.OpenWeb();

               SPUser user = web.AllUsers[strDomainUser];

               return user.ID;


           return 0;



  222. Elfoamerican says:

    You can easily get email at least for the predetermined amount of entries if you have access to the Sharepoint’s UserProfileService.asmx without writing any code behind.

    For example for the first entry all what you need is to assign that field in an action:


    to the service parameter:


    in the next action you should call Query using data connection

    after that  you should have your email populated in the service structure

  223. abhishekv says:


    This is a great article.

    I am new to infopath. I have implemented this contact selector control and it is working properly in Infopath.

    I have published this in Sharepoint and is opened from there.

    Say my name is Ramanan, Abhishek(Lastname, FirstName), and I enter ‘Rama’ in the contact selector and click search I am gettin this error.

    ‘There was a form postback error. (User: MEDIMMUNEVenkataramananA, Form Name: New Card Application Browser, IP: , Request: http://md1vm098/_layouts/Postback.FormServer.aspx, Form ID: urn:schemas-microsoft-com:office:infopath:New-Card-Application-Browser:-myXSD-2008-12-08T17-19-57, Type: SchemaValidationException, Exception Message: Schema validation found non-datatype errors.)’

    Please help ASAP.

  224. infopath says:

    Hi abhishekv,

    Here is where I would start to troubleshoot this:

    – Enable Verbose logging for the following categories:

        – Feature Infrastructure

        – Forms Services Data Objects

        – Forms Services Runtime

        – Forms Services Runtime – Data Connections

    – Reproduce the error and then check the latest SharePoint ULS log…hopefully this will point you to a more specific error indicating the problem.

    If you don’t get any additional details in the logs then I would select the "All" category, set this to Verbose, repro the error and check the logs again.

    We should be seeing something in the ULS log that points you to the issue.


  225. Elfoamerican says:

    Here is my blog where email problem is solved

  226. says:

    Hi Scott,

    Thanks for the great article.

    I am using contact selector in browser based InfoPath form. In the form there are three contact selector and they are optional based on business logic.

    By default I have assigned a value “NA” to the AccountID field. This defaulted value is also used in the associated workflows.

    Whenever this form is opened, there is a 7 to 20 second delay. When I went thru the SharePoint logs, I noticed a error message “Error in resolving user ‘NA’ : System.Runtime.InteropServices.COMException (0x8007203A): The server is not operational”. This message appears maximum three time and each one takes approximately 7 seconds (timeout).

    To eliminate this I have changed the form by setting AccountID field to blank. Now I do not get this timeout.

    My question is:

    [1] When a correct full name or account ID is entered, the control validates in no time. But whenever a wrong/partial user name is entered in the control for validation, the control takes 7 seconds to return back. Why this much of a delay?

    [2] Is this timeout set in SharePoint or AD? Any way to reduce this timeout?



  227. infopath says:

    Hi Prabhu,

    This behavior is not specific to the Contact Selector control – if you were to enter: NA in one of SharePoints "People Picker" controls, you would see the same behavior. This is because that control (People Picker and Contact Selector are basically the same control) is attempting to validate that user (in this case the "NA" user) in every domain in your forest. The same is true for an invalid user. If you just enter the invalid user name, it attempts to validate that user in every domain. If you were to enter an invalid user as: domaininvalidname then it would attempt to validate that user just in that one domain.

    To the best of my knowledge there is no way to control a timeout on these controls but if you want to be 100% sure you may want to post that question to a SharePoint blog.


  228. hiszorn says:

    We are setting our contact selector from a workflow and when our browser form is opened, the selector shows strange information in front of the name like 16:#  Has anyone seen something like this?  Any ideas of how to fix that?  Thanks!


  229. infopath says:

    Hi hiszorn,

    I am not a workflow expert but I have seen this same behavior depending on how I pull the information from SharePoint. If you step through your workflow code that pulls the user name, before you populate the control do you see the "16#" information? If so, then you should be able to strip that off using the substring function.


  230. hiszorn says:

    Hi Scott,

    For some reason, this strange value changes to different numbers (16;# and 17;#) depending on the person the selector has been set to.  I will check to see if we can see that value in the workflow.  Strange one though…


  231. NohaMohsen says:

    Hi SCott,

    Do you have any idea how can i call from the code the validate of the control….that is it validate what is entered in the field by calling the code.

  232. infopath says:

    Hi NohaMohsen,

    I am assuming that what you want to do is validate the text that is entered before the control resolves that user name – correct?

    If so – I know of no way to do this. You could add code to the "Validating" event of the "Person" node but this fires after the control has resolved the name.

    One possible option would be to have the user enter the text in a text box control (maybe initially you would have the Contact Selector control hidden) so you could validate the data that was entered. Upon validation, set the "DisplayName" node of the Contact Selector control to what they entered and then make the Contact Selector controkl visible. The user would still need to click the "Check Names" button to resolve the user but at least you would have the ability to validate the text they entered.


  233. InfoPath is a great tool that allows you to quickly design and implement browser-based electronic forms

  234. fodi says:

    Hi Scott,

    I’ve created a custom SharePoint workflow in VS2008. It uses InfoPath task forms to manage the approval process.

    When a workflow task task form is opened in Outlook 2007, the user can complete the form by clicking the "Edit this task…" button directly in Outlook.

    This is the first time I’ve had to add a contact selector control to a task form. The contact selector works correctly when you modify the task from within SharePoint.

    When I modify the task from within Outlook, the contact selector does not return any names and responds with "Search failed.".

    I created a Context.xml and set it as a ‘receive’ datasource as you recommended, to no avail. Have you any suggestions on this one?

    – fodi

  235. fodi says:


    I think I solved this issue. After trying to fix it for two days, I posted on the forum and fixed it an hour later… go figure.

    In the end, I used the full Context tag, as described on MSDN:







    I don’t think that’s what fixed it though.

    Golden rule: If you’ve got InfoPath installed locally it will cache forms. This also applies to forms that are opened within Outlook 2007. After making changes to these forms, make sure you run:

    Infopath /cache clearall

    Hope this helps someone else down the track.

    – fodi

  236. infopath says:

    Hi fodi,

    Thank you for the information – I am glad you were able to get this working!


  237. ganeshba says:

    How do I reset an entry in the contact selector?  I have only one entry picked.  To reset, I set the DisplayName value to "".  It seems to work in Infopath but on the browser version via Sharepoint, the entry does not clear.   Will it require custom code?

    Ganesh Bala

  238. Phil Birkland says:

    I have two issues with my contact selector:

    1)  I have several contact selector’s on a form. The form has a submit button that submits the form to email not as an attachment. The contact selectors always show up black, and I am unable to read the what the user entered into the form. I try to change the background color, and it appears as though it works, but then it reverts back to black as soon as I go back to the properties to see if my change persisted.

    2)  Infopath has been crashing on me consistently whenever I hit Print or Print Preview not from the template but from a filled out form, or a preview of the form. I have isolated the occurrence of the crash to only occur when a contact selector is on either my print view or even the normal view.   Any thoughts on what to do to resolve this crash and still use a contact selector? Or any other ideas?

    Not sure if these two are related or not, but it seems plausible.

  239. infopath says:

    Hi Ganesh,

    To clear the Contact Selector control in a browser form, there are two things you will need to do:

    1) Use a Rule to set all three fields for the Contact Selector to an empty string

    – Action: Set a field’s value

    – Field: DisplayName

    – Value: <Just leave this blank>

    Do the above for all three fields

    2) Assuming you are using a button to clear the Contact Selector control, you will need to change the postback setting to "Always"

    – Right-click on the button and choose Properties

    – Select the Browser Forms tab

    – Change the Postback setting to Always

    Re-publish the XSN.


  240. infopath says:

    Hi Birkland,

    – For question #1: are you saying that when the form is received in e-mail you cannot make out the text in the Contact Selector control or is it the entire form that is "black?"

    – For the crashing question, do you get the same behavior if you create a completely new XSN following the steps in this blog post?


  241. Phil Birkland says:

    Hi Scott,

    – Just the contact selector is black.  You can see a screenshot at:

    Also, I have checked the background color, and tried to change to another color, but after I hit ok, and go back to verify my change, the color is back to black again.

    – I have to give this a try … more to come …

    Thanks for your help!


  242. Phil Birkland says:

    Hi Scott,

    So I tested this with a new form, and it appears as though the form only crashes when I open an infopath form that has already been submitted to my document form library.  If I start any new form, fill in data, and hit print preview or print then it is fine.


  243. infopath says:

    Hi Birkland,

    OK – I’ve done some testing on my side and I am not seeing the same behavior as you in regard to what you see in mail. I have tried with my submit connection set to both attaching the form and not attaching the form and in both cases, I actually see nothing in the Contact Selector control (in fact, I don’t even see the Contact Selector control.)

    Now, this actually makes sense since this is an ActiveX control and the information being stored is in the DisplayName, AccountId and AccountType fields.

    So I am not sure why you are seeing black but even if you didn’t, you will probably want to create an "e-mail" view where you don’t have the Contact Selector control but simply the DisplayName or AccountId fields in its place. You would first switch to this view and then send your mail. (NOTE: You should be able to just copy/paste all the controls from your current view to a new view and then simply remove the Contact Selector control and replace it with one of the other fields.)

    In regard to InfoPath crashing when Print or Print View is used with the Contact Selector control – I found this is a known issue that our Product Group. Now again in my testing, I can successfully use: File | Print | Print Preview but if I just choose Print Preview from the File menu it fails.


  244. Phil Birkland says:

    So if for the contact selector showing up black, if I have two submit actions.

    1. Submit to library

    1.5 change view to print preview view, or would a print preview not work.  I thought I had tried this, and the entire form was white or blank, I couldn’t see anything, but I did not try a regular view as opposed to a print view.  I’ll give that a go around.

    2. Submit to email

    I will also test out just using the File Print Preview action as well.

    Thanks for your help.  


  245. Phil Birkland says:

    Hi Scott,

    Even File | Print | Print Preview throws exceptions on me everytime.  I also moved my other issue regarding changing views for emails to somewhere that seemed more appropriate on your blog at:


  246. infopath says:

    Hi Birkland,

    I am not able to reproduce the crash on XP or Vista machines using File | Print and then clicking the Preview button.

    Keep in mind, I am testing using the same form as what is designed in this sample so there may be something else going on with your form template.

    I also have Service Pack 1 installed for Office – so if you can repro the crash using the same form as designed in this blog post and you have SP1 installed for Office 2007 then you will probably want to open a support case so an Engineer can dig into this more, capture traces, etc. to try and isolate the issue.


  247. slslusehr says:

    I’m a little new to writing code and for some reason I can’t get the control to work.  The search keeps failing.  I’m pretty sure it has something to do with the way I’m pointing to the server.  Here’s what I’m putting.

    <Context siteUrl="http://doc1xxxxx103"/&gt;

    Should I be using the site url where the form is published?

    <Context siteUrl="http://sitename/subsitename"/&gt;


  248. Phil Birkland says:

    Hi Scott,

    I figured out what it was with the crash.  I had the view set to as a print view.  But then under View | Print Multiple Views settings, the non print view was selected as the one and only view to print.  I changed this to the print view, and duhh, things worked just fine.

    Thanks again,


  249. ganeshba says:

    Hi Scott,

    Your response to my question on

    "How do I reset an entry in the contact selector? "  was a life saver and it worked out great.

    Thank you

    Ganesh Bala

  250. infopath says:

    Birkland – nice find! Glad that the Print Preview is now working for you. 🙂

    Ganesh – I am happy to know the information helped!

    Sherry – The "Search failed" may or may not be related to the URL you are entering. That is certainly the first thing I would change and see if it makes any difference. If not, let me know and I will have some additional troubleshooting tests.


  251. says:

    I am still having issues with Printing the Contact Selector field. I have made a sepeerate printing view but still seem to not be able to print it… I’m somewhat of a novice at infopath so any replies please make them accordingly. Thanks for your help in advance…

    What I have done so far:

    1. Made seperate printing view first with display name, then with the other option listed above. Both did not work.

    2. jacked with the print multiple views option but that didn’t work either.

  252. infopath says:

    Hi amo368,

    Can you provide more detail around what did not work? For instance, when you create a separate print view you would not include the Contact Selector control – you would just include the DisplayName and/or the AccoundId nodes.

    Now, once this is done you will need to specify your "printing" view as the "print" view:

    – Open the XSN in Design View

    – Select the Views Task Pane

    – Click on your Default view and click the Properties button

    – Select the Print Settings tab

    – Make sure your new "print" view is set in the "Designate an existing view to use when printing this view" box

    – Repeat the above for all views you have in your XSN


  253. says:

    Awesome! THanks! That worked, now I just need to tweak it to make it look good. Thanks a LOT. You dont know how much heartache you saved me.

  254. Phil Birkland says:

    Hi Scott,

    I have another question for you, the IT police at my organization are yelling at me, since the data or email recipients that are tied to sharepoint through this web service is not entirely accurate for reasons I do not understand quite yet.  One of the reasons for this is that the sharepoint directory of users contains members that have left the company, and are no longer active in the normal outlook exchange directory.  Also generic IDs are included in the sharepoint directory of users, and PDLs are not in sharepoint

    The recommendation to me was to search out other controls that would not use a sharepoint directory by tie more directly with the outlook directory, possibly through the control "Microsoft Office Outlook: recipient control" or something similar.  

    Are there other similar controls?



  255. infopath says:

    Hi Birkland,

    There are no other "out of the box" controls that do this. If you are creating an InfoPath Form Template that will *only* be used in the InfoPath client then you could conceivably create your own custom ActiveX control to do what you want; however, if your form will be used in the browser then this is not an option as Forms Services (browser forms) do not support any custom ActiveX control.

    The other option would be to simply use a text box for the user to enter the name, logon, whatever and you use custom code query your Active Directory for that user.


  256. harbrich says:

    Haha Scott I just wanted to mention I think it’s funny how long this comment list has become. You are a champion for keeping up with all the different queries, ideas and responses.

    *tips his hat*

  257. infopath says:

    Thanks harbrich! 🙂

  258. DaFlea says:

    Great article but I have a question….

    I have the contact selector working on the form, however every time I select an employee from AD and goto insert another item. The repeating region goes blank on my form.

    I have been searching the web for some examples of how this control is being used to examine what I may be doing wrong, but I am coming up empty. Does anyone have some suggestions that could aid me on this issue?



  259. infopath says:

    Hi Doug,

    I am not sure I understand the behavior you are describing. Do you have the Contact Selector control in a Repeating Section? Can you describe your setup more so I can get a better understanding of how your XSN is designed?



  260. DaFlea says:


    Thanks for your reply.

    What I am trying to achieve is a repeating list where each line will allow you to select a person from active directory using the contact selector. What happens is after I fill out all the items including the contact selector item and click the insert item to add another line is when the problem starts. Everything in the repeat region completely disapears, it is as if it was never there.

    Am I using the control incorrectly, should it not not be used in the repeat region.  Or should it be outside the repeated region.



  261. infopath says:

    Hi Doug,

    This should work for you – here is some sample steps I just tried that work fine for me:

    – Create a new, blank XSN

    – Add a Repeating table with 2 columns

    – Delete "field2" ( = the 2nd column) and delete the text box from the table for field 2. At this point, my data source looks like this:





    – Add the correct data structure to the data source for the Contact Selector:





                  gpContactSelector (Group, non-repeating)

                       Person (Group, repeating)

                            DisplayName (Fields, Text)

                            AccountId (Fields, Text)

                            AccountType (Fields, Text)

    – Drag "gpContactSelector" to the repeating table where field2 used to be and choose Contact Selector

    – Add the connection for Context.xml

    – Test!

    When I do this, I can add multiple rows and each Contact Selector is updatable and independent of the other.


  262. DaFlea says:


    Ok I have try what you have instructed in a new form and in the one I am playing with.

    However now when I place a name in the contact selector and click the check mark I get no results and the contact selector gray’s itself out… This is far better than everything disappearing like before

    I have re verified my case to make sure everything matches and I am using the same XML file as before so I know it was linking back the server correctly..

    Any suggestions…

  263. DaFlea says:

    Let me rephrase whats going on because I have had some different results now.

    The new form still will not find anyone in the directory, which I believe is due to the fact its not prompting me for credentials to the SharePoint site. I did find an error on my part not putting the Person repeating group in the list however this still doesn’t allow it to work.

    My original form I have been working with will now look up the contacts again, same issue forgot the Person group as well.  However after picking the person in the directory the control will gray out making it usable.

    The original form does ask for credentials when opening because I have it attached to some SharePoint Lists.

    FYI: Currently the way we are setup is not everyone is on a central domain and everyone has to access the site over http causing them to log on when things are accessed.

  264. infopath says:

    Hi Doug,

    The only time I have seen the "grayed out" behavior is when the Contact Selector nodes either not spelled correctly *or* the case of the names is incorrect. For instance, if I simply change: AccountId to AccountID, the form will open fine and the control will appear to work but as soon as I select a user, it becomes grayed out.

    So the first thing to check is the capitalization on all nodes specific to the Contact Select control (Person, DisplayName, AccountId and AccountType) have the correct capitalization.


  265. jestiles says:

    I have a couple of questions/issues about the CSC since we upgraded our MOSS 2007 to a 64-bit machine…

    I have added the Contact Selector to my browser-based form and followed the steps suggested to make the control required, however, as soon as I click in the control itself, the page refreshes and submit is enabled. This happens before I even get to type a name.

    When typing a name in the control to resolve against AD, sometimes the name will resolve and other times it doesn’t. It is very random as to when this happens!!

    Also in this, if a user in AD has 2 accounts (one is their voicemail acct and the other is their regular email acct) a box pops up for them to select which account to use each and every time you type that users name. In our 32-bit environment it didn’t do this.

    Any help or suggestions is greatly appreciated!!



  266. DaFlea says:

    I will call this a dyslexic moment for me… The AccountId got me. I must have had it misspelled because the Id part was right. After retyping it everything work like a charm.

    Thank you for your help on this matter.

  267. infopath says:

    That’s great to hear Doug! 🙂

  268. infopath says:

    Hi Jessica,

    Let’s look at each of your scenarios:

    #1: Automatic postback when clicking into the CS control: I just tested this on a 64bit server and am unable to repro that behavior. I simply added a text box control to the sample I created here, pleaced it above the CS control (so it would receive focus first) and opened the form in the browser. When I then click into the CS control, nothing happens.

    Now, the way I am validating that the Submit button is not enabled is to check if the DisplayName field "is blank" – is this what you are doing? Do you have any code behind the InfoPath form?

    #2: Random resolution of names: I honestly don’t have any ideas on this…does it randomly not resolve names that it used to or is it just not resolving some names? Without being able to repro this though or get a repro nailed down, I don’t know that I will be able to offer much help.

    #3: Account to select: This obviously makes no sense since the control is still 32bit and Office (which you are using to publish) is 32bit. Does the same behavior occur if you use the SharePoint People Picker control to add that same user to give them permissions to, say, a test library?  (Obviously to test this you would need to break inheritence for that library and try to add the user explicitly.) If this does not reproduce the issue, then this would probably be worth opening a case with the InfoPath team so we can look into this more. I would need to setup a repro which will take a while to get multiple accounts for the same user on our domain.

    Thanks Jessica!


  269. Cuando diseñamos un formulario para ser utilizado en Infopath Forms Services debemos tener en cuenta

  270. Some time ago now, I published a post entitled Quick Tip: Using the SharePoint ‘Person or Group’ field

  271. amdMcBook says:

    Putting the server URL in the Context.xml is great, but how does one handle moving the XSN from Dev to QA to Prod without having to resort to editing, publishing (and in my case WSPing) the XSN file once for each environment?

    I have tried to workaround this by always using the Prod url regardless of the environment, but I am getting "Search Failed" when I do that. I do seem to have permissions to the prod site (i can browse to the root URL

    Any best practices around this? Thanks

  272. infopath says:

    Hi amdMcBook,

    For this specific issue (updating the server URL in the Resource file) there are a few options:

    1) As mentioned, update it and re-publish the XSN

    2) You could use code on the Loading event of the XSN to set that value to what you want it to be. This will not persist once the form is closed but if the code is on the loading event, it will run each time and update that value for that instance of the form.

    There is not a way to point this to something like a "config" type of file and have it pick up the change.

    NOTE: If you are using this in a browser form, it has been my experience that it really should not matter what URL you enter in the Context file. This will come into play when opening the form in the InfoPath client since it needs to know what site should be used but in the browser, it will execute the search based on the URL used to open the browser form.


  273. I know what you’re thinking ….”Wooohooo … yet another article from Martin about InfoPath and the Contact

  274. The Exception says:

    Hi scott,

    I am using contact selector control in a repeating table. Now i want that a mail should go to all, whose names i mention in contact selector control in each row. I am writing only single name in a contact selector control in each row.

    How can i do this?

  275. infopath says:


    You can do this by adding a new field to your data source and setting the default value to something like this:

    substring(xdMath:Eval(xdMath:Eval(/my:myFields/my:gpContacts/my:gpContact/my:group1/my:Person, ‘concat(substring-after(my:AccountId, ""), ";")’), ".."), 1, string-length(xdMath:Eval(xdMath:Eval(/my:myFields/my:gpContacts/my:gpContact/my:group1/my:Person, ‘concat(substring-after(my:AccountId, ""), ";")’), "..")) – 1)

    NOTE: Here is my sample data structure, which places the Contact Selector control in a repeating table:


        gpContacts (Group, non-repeating)

             gpContact (Group, repeating)

                  group1 (Group, non-repeating)

                       Person (Group, repeating)




    I then added a new node to my data source (it does not have to appear on your view but is a good idea initially for testing) called: emailAddresses (I just right-clicked on the root myFields node and added the field.)

    If your data source is setup *exactly* as I have described above you should be able to do this:

    – Right-click on the new emailaddresses field and choose Properties

    – Click the "fx" button next to the Default Value box

    – Enable the option "Edit XPath"

    – Paste in the expression noted aboive

    What this will do is add each selected name in the repeating table to the "emailaddresses" field separated by a semi-colon.

    I hope this helps!


  276. ThomasCBarkley says:

    I have an unusual scenario, my client wants an InfoPath for to select contact from the local Outlook contacts list.

    Is there a way to do this?



  277. infopath says:

    Hi Thomas,

    There is no out of the box way to accomplish this – you would need to create a custom process for your customer.


  278. says:

    Hi Thomas

    There is one way to do this. It is not the best approach but see if this is little helpful. Make a SharePoint custom list and put all the contacts in that list. Now while designing an Infopath form, u can set a receive data connection from that custom list. In this way u will be able to see all the contacts and your client can easily select. U can use list box to show all the contacts.



  279. says:


    I really admire u for answering each and every doubt of everyone. Really, i appreciate u a lot for this. Scott, few months back u gave me the solution of sending mail through contact selector to several people. Now i have a doubt. If i select a group in Contact Selector, then it is sending mail to all the members of the group but i also want the users to see the members of that group. While sending mail and in infopath form, it only shows the name of the group but not the members.

    Now how should i extract the names from the group(which i entered in Contact Selector) in infopath form?



  280. infopath says:

    Hi Ginni,

    The only information returned in the Contact Selector is simply the name of the group if its been validated. As such, you would need to use another call (i.e. to a web service) to get the users that are part of the group.

    There is a SharePoint "UserGroup" web service (usergroup.asmx) that can be used to enumerate the users in a specified group. In order to use this in InfoPath you will need to make some modifications to the XSD files that are created when you make the connection and the steps to use this web service are documented here:


  281. says:

    Hi Scott,

    I read that article. Its nice, but there i need to mention the name of the group while setting a data connection and also at one connection i can mention the name of only one group.

    My requirement is like i want to get the usernames of the group which i will mention in the Contact Selector control.

    I am not getting any info regarding this anywhere. Can me help me in this?



  282. says:

    I mean can u help me. Sorry for the last line

  283. infopath says:

    Hi Ginni,

    As you know, the users or groups you select in the Contact Selector control are stored in the repeating "Person" node. So what you can do is use code to loop through all the rows in the repeating Person node and pass each selected group to the "UserGroup" web service to return back the users in that group.

    There is no out of the box way to do this so you are going to need to implement something custom like this to get what you want.


  284. BlueChan says:

    Scenario: Initiator fills out a new form opened from a Sharepoint forms library and sends it to an approver. While filling out the form the initiator selects users with the contact selector. The approver receives the form via email and opens the form to add users via the contact selector.

    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."

    I’ve tried to send the form via email without the template which I would have thought would force Infopath to download the template from Sharepoint but this didn’t have an effect.

    The publish location (Sharepoint site) is in the trusted sites list in IE.

    Any help would be appreciated.

  285. infopath says:

    Hi BlueChan,

    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.


  286. BlueChan says:

    Is there a group policy or some other centralized way of working around this?

  287. robholmes says:

    We are experiencing the exact same issue when using the contact selector from within Outlook.  

    We tested this out and found that when the InfoPath form was opened from within Outlook it populated the InfoPath cache directory on the local computer with the template and the only items it seem to save to the Temp Internet Files was the images from the form and a cookie.

    I tried Scott’s suggestion of saving the form locally after it has been sent to an Outlook client and the contact selector did work. However, this isn’t a viable solution in our environment as we cannot ask our users to do this as it’s not intuitive (especially since the error message infopath prompts with would only confuse them further).

    Even adding the local client to the trusted sites list within IE still had no effect and the contact selector was still unusable through Outlook.

    Is there another way around this or is this a bug?

    Thanks for you help.

  288. MAV says:

    Thanks for all the great info Scott. Really helped out!

  289. infopath says:

    Hi Mav – thank you!

    For BlueChan and robholmes…sorry for the delay as I was trying to find a way around this but I came up empty. As such, I have sent this behavior to our product team for review.


  290. adayuen says:

    First and last name separated by colon instead of comma using "Check Name" in InfoPath browser form "Contact Selector"

    Dear All,

    I have installed Windows hotfix for making the InfoPath 2007 client application to use comma to separate first name and last name in Contact Selector "Check Name" function. However, I published the same form to SharePoint Server 2007. It failed to separate the first name and last name with comma but colon with "Check Name" function.

    The form has been launched for company use and users are not satisfy with the email check name function. Please help to shed some light on how to make the "Check name" function work properly in SharePoint Server 2007.

    If there is any patch need to install to SharePoint server, please suggest.

    Thank you very much!



  291. infopath says:

    Hi Ada,

    Are you referring to the behavior when you display an InfoPath form in the browser? If so, then yes – there is an additional server side fix that you will need for this.

    I am not a SharePoint/MOSS expert so I don’t want to recommend what you should install as it depends on what service pack for MOSS you currently have installed. I believe the server side fix was part of an Infrastructure Update (see;EN-US;951297) but again I would suggest you follow-up with either a SharePoint blog or open a support case with the SharePoint team to insure you install the correct update.


  292. adayuen says:

    Dear Scott,

    Thank you for your reply!

    I have asked server team to consider to upgrade the service pack.

    Beset Regards,


  293. adayuen says:

    Dear Scott,

    It works like a charm for the new Infrastructure Update. This is the best blog for InfoPath form.

    Appreciate your knowledgable response.

    Thanks a lot!


  294. infopath says:

    Hi Ada,

    That’s great to hear!

    Take care,


  295. Рано или поздно, всем приходится писать рабочие процессы с формами ассоциации, инициализации, редактиварония…

  296. davidevan says:

    First of all I want to say thanks for a great tutorial. I was able to walk through it and set the control up on a web based InfoPath 2007 form.

    I’m running into an issue with this control. The first time I open a form in a browser (IE8) and attempt to type a name into the contact selector input box my browser crashes (instantly on the first keystroke the browser will crash). I get "An unhandled win32 exception occure in iexplore.exe [5460]". I’m able to select users from the list when I select the "To.." button. I’m also able to type in the contact selector input box if a name already exists in it (populated from the To.. button). The only time it crashes is if it’s the first time I loaded the form and if the contact selector input box is blank. Any ideas?

  297. davidevan says:

    Ahhh, it turns out to be a bug in Internet Explorer 8! It works fine with IE6, IE7 and Firefox 3. Someone else must be having this problem?

  298. infopath says:

    Hi davidevan,

    I am not seeing the same behavior with IE8. I just opened a test form on my site with the Contact Selector control using IE8 and I could type in the name and validate it without issue.


  299. davidevan says:

    Scott, thanks for the quick reply. That’s interesting how it is working for you. I’m using version 8.0.6001.18702 of IE8. What version are you using?

    Of course I just tried again and the error still occurs. When you open an exisiting form in IE8 and you use the contact selector, does the error occur?

  300. davidevan says:

    Scott, thanks for the quick reply. That’s interesting how it is working for you. I’m using version 8.0.6001.18702 of IE8. What version are you using?

    Of course I just tried again and the error still occurs. When you open an exisiting form in IE8 and you use the contact selector, does the error occur?

  301. infopath says:

    Hi davidevan,

    Yes – creating a new form in the browser or opening an existing saved form in the browser works without issue for me.

    My version of IE is: 8.0.6001.18783 – slightly different than yours.


  302. says:

    Hi Scott

    I could create multiple contact selectors as described above – works like a charm!

    But how can I enforce that people have to select at least one contact? If I set the template’s value "DisplayName" in the properties pane to "Cannot be blank (*)", I receive everytime I submit the form the error, that DisplayName cannot be blank, though I filled out all required fields on the form.

    Thank you for any help.



  303. infopath says:

    Hi Markus,

    Yeah – this is not the easiest thing in the world to do. 🙂

    If I may ask, what is it you are ultimately trying to accomplish? (Making sure at least one user is selected before the form can be successfully submitted?)


  304. Nick H says:

    This blog and your posts were the most helpful thing on the Internet imo.

    I am having trouble still with the Contact Selector.  I used the steps you gave an earlier poster:

    Created a new Document Library named: ContactSelectorTest

    – Enabled the option: Allow management of content types

    – Added a new column to this library named: Responsibilities and set the data type to Person or Group

    – Clicked the Document Content Type and selected Document Information Panel settings

    – Clicked Create a new custom template

    The contact selector that appeared in the template was able to access the Active Directory.  My problem is that the template does not allow me to add controls to it (at least not allowing them to be added into the data source).  Vice versa, I was not able to move the working Contact Selector into the template I have been working on.

    Any advise is appreciated.

  305. infopath says:

    Hi Nick,


    Correct – when you create an InfoPath template in this manner, the schema is locked as it is based on the library. What you would need to do is create whatever columns you need in your library and then modify the Document Information Panel. Now those additional columns will appear in the data source and you can use them on the InfoPath form.


  306. Nick H says:

    Thanks for the feedback.

    I’d prefer doing this sort of thing from Infopath as I have a form I’ve been working on and I don’t know how to add controls like sections via adding columns to my Document Library.  I just wanted to use the Contact Selector in the form I’ve been working on really.  I just thought that the SharePoint method was good since it seemingly automatically configured itself to search the Active Directory.

  307. infopath says:

    Hi Nick,

    Yeah – you certainly have more flexibility when you start with InfoPath. When you start from SharePoint (regardless of from a content type or library) your schema in InfoPath is locked so any changes you want in the XSN need to exist SharePoint.


  308. Nick H says:


    Alright so I am attempting to add a Contact Selector through Infopath following the steps you gave.  I believe that I have successfully completed Steps 1-3.  I am able to drag and drop the gpContactSelector group and choose "Contact Selector" from the menu that pops up.  I have replaced <servername> in Context.xml with many different IPs/server names.  I have attempted:

    – SharePoint server name/IP

    – Active Directory server name /IP

    I am not really sure what the server name I need to replace <servername> with.  I’d appreciate any help.


  309. infopath says:

    Hi Nick,

    You would simply use your MOSS WFE name. If you have multiple WFE’s, I am assuming you would then have a load balanced URL and you would use that. However, if this form is to be used in the browser, then it will use the URL of the site it is published to. The server name is really only needed (in my testing) when you use the InfoPath form in the client and not in the browser.


  310. Nick H says:


    I tried using the IP to the load balancer and the url to my mysite on SharePoint but still no dice.

    Could you post an example or something of the URL you might put into Context.xml?

    Sorry for the hassle, I’m not very hardware or network savvy.


  311. infopath says:

    Hi Nick,

    What do you mean by "no dice" – what is the problem? I only have one WFE, so here is what I have in mine:

    <Context siteUrl="http://servername"/&gt;


  312. Nick H says:

    Alright! I got it working.  Thanks for hanging in there with me Scott.  I believe that I didn’t save my Context.xml properly or I didn’t add the data connection properly after trying different URLs in Context.xml.

    I have a quick question.  Once you have selected a person in the Contact Selector, how is the e-mail address information used?  All I want is to submit a form to each person selected in the Contact Selector.

  313. Nick H says:

    I just read that you do not get e-mail address information from the Contact Selector.  

    Maybe in the next version of Infopath, they should add a field that extracts the e-mail address from a contact that is found.

    I should be able to get by with parsing the DisplayName attribute.

    Thanks again,

    Nick H

  314. dvn says:

    But it is doable without using any codes and here is the link to it:

    I have one question. According to the support Engineer it is posible to create a "contact selector template part" but when i try to create a template part and contact selector control is disabled and i can’t add it in to my template part. Has anyone ever done that before?


  315. infopath says:

    Hi dvn,

    This was discussed in the comments as my initial statement was not clear: the template part you create is just the "data structure" which you could then bring into your XSN. You cannot add the control itself to the template part. (Refer to my comment on Apri 16, 2007.)


  316. Nick H says:

    I apologize for having so many questions.

    I tried your validating event code for limiting the Contact Selector to one entry.  If I search and add 2 entries, the validation dashed red box does not show up unless I click check names.  Did I do something wrong, do I need to add something, or is there no way around this?

    Thank you for all of the help.  I really do appreciate it.

    Nick H

  317. infopath says:

    Hi Nick,

    No problem – glad I can help!

    Unfortunately you need to validate the user. You can see this if you drah the "Person" node to your view as a Repeating Table. That data structure does not get populated until you validate the user or users selected. And so that you are aware, the same is true if you reverse the process: if you select a user and then just delete the name from the Contact Selector control, it does not get removed from the Person node until you validate the fact that you deleted the name.


  318. Sono says:

    I have an infopath form with contact selector serving as a workflow modification form. But when I click link to open this form it leads me to the sharepoint page showing "Unknown Error". This form works fine in Non shrepoint environment even I have tried it using as Task Form. It creates problem only while used as modification form. I have tried diagnostic logging as well but no log entry is generated for this error.

  319. infopath says:

    Hi Sono,

    If the InfoPath form works fine outside of your workflow then your best option will be to post your question to a SharePoint workflow forum or blog as we do not handle workflow issues.


  320. fraygos says:

    Hi, this is a great article. Although I found a tiny itty bitty problem. We are using this example to create a service form. Someone makes a request and uses the selector to make choose someone to be assigned this request to.

    I have a View for this form where people view requests filtered on the selectors extracted column is equal to [Me]. We then create Alerts from this View to alert our staff when something is assigned to them.

    However, when I publish the form, the best I can use is ‘Display Name’ to filter on but this gives an error when creating the view. It does not allow filtering on ‘Display Name’ because is multiple lines of text and using begins with or contains produces a render fail on the results of the view, hence stopping the alert. Is the anything I can do to have the column type for the contact selector form be extracted as a type ‘Person’.

    Is there a better way about going with this?

  321. Nick H says:

    Hey fraygos,

    I am new to Infopath so I doubt I can be of much help.

    A good way to understand the Contact Selector is to drag and drop gpContactSelector into your form and select "Repeating Table".  Essentially, the Contact Selector adds a row and fills in the row’s values every time a contact is selected with the control.  

    I looked all over the Internet to find a way to try to get data from a specific row/column of a repeating table/field but I did not find anything.  Maybe you know how to do this.

    Anways, I’d bet that the infopath team will help you with your problem shortly.

    Nick H

  322. infopath says:

    Hi fraygos,

    Unfortunately there is no out of the box way to promote a column as Person/Group or bind to an existing column as Person/Group. However, what I have done to get this to work is to use SharePoint Designer to add a workflow to the library where I have created my Person/Group column and then use the workflow to set the value of my Person/Group column to the "AccountId" field that I promoted from my InfoPath form.

    I hope this helps!


  323. Nick H says:

    ^That helped me a lot Scott.  Thanks.

    Nick H

  324. mat1583 says:

    I have found 2 roadblocks to using the InfoPath Contact Selector in browser-based forms. These seem to be bugs…

    1)In both Safari and Firefox 3.5, when the Contact Selector checks to make sure the name entered is in AD, it adds an empty user and then pops up a dialogue box to resolve the empty user. ex: " ; LastName, FirstName" (without quotes) is what is in the field. IE 7 and 8 do not do this.

    2)In Safari, once you add a user, you are unable to delete that user. You can delete the user in FF and IE.

    Are these reported bugs, and will they be resolved anytime soon? This is unacceptable behavior for the control. Our clients are not happy with it, and neither are we.

  325. infopath says:

    Hi mat1583,

    Thank you for bringing these issues to our attention. I searched through prior support cases we have received and was unable to find where this behavior had been brought to our attention before. So the first thing I want to let you know is our product group was not aware of these behaviors.

    I have been able to reproduce the behavior you describe in both Firefox and Safari and will be submitting these to the product group for review. However, I don’t have a time frame on if/when this may be addressed.

    Thanks again,


  326. mat1583 says:

    Thanks for the reply, Scott. I was able to workaround the ‘can’t delete’ issue by adding a clear button which uses a rule to clear AccountID, DisplayName, AccountType and reset our user count (since we have validation to limit to only 1 user). Safari and FireFox together make up a third of our traffic, so the extra blank user problem could be pretty confusing for a lot of people. This post was EXTREMELY helpful for me, but it was a big disappointment to get this far and discover problems like this. Hopefully it will be resolved soon. I’d love to use it in other forms we’re developing if it will function correctly in other major browsers.

  327. infopath says:

    Thanks mat1583 – I am glad you found this useful!

    I have submitted this behavior to our product group so hopefully this is something we can look at for a future service pack.


  328. minhasquier says:


    I’m working with an InfoPath form which must have some Contact Selector controls to validate users from the MOSS server’s AD.

    I’ve done all steps as they’re explained in this post, but the contact selector does not validate any user, and when I try to search for users clicking on the "To" button, it could not search for them.

    I’ve already tried to change server name with IP address in Context.xml, but still can’t search or validate users.

    What could be the cause of this problem?

    Thanks in advance.

  329. infopath says:

    Hi minhasquier,

    Can you verify that the node names in your data source are spelled correctly AND the capitalization matches what is in this post?


  330. minhasquier says:

    Hi Scott,

    I’ve checked it. All the groups that I am using with contact selector have the same structure, including correct spelling and capitalization, as it’s specified in the post.

  331. infopath says:

    Hi minhasquier,

    Can you check and make sure you can successfully validate a user with the built-in "People Picker" control in SharePoint? Try these steps:

    – Navigate to the same site you are trying to use with InfoPath

    – From the Site Actions button, choose Site Settings and then choose People and Groups

    – Click New

    – Enter the same name in the Users/Groups box and click the "Check Names" button…does that user get validated?

    If so, are you testing the control in the InfoPath client or in the browser? If you are not testing in the browser, please publish the XSN to you site, open a new instance of the form in the browser and what are the results of the control here?


  332. aliciacpq says:


    Great instructions! Thanks. In testing the instructions there is an error submitting the form when I click to resolve the name.

    I went back to the template and ran the design checker and got "The SOAP message could not be parsed"

    Any tips?


  333. infopath says:

    Hi aliciapq,

    The first thing I would do is start over with a new, blank XSN and insure that you have named *everything* identical (including capitalization) to what I have here in this post. Then test and see if you have any different behavior – most issues I have seen stem from either the data source not being constructed correctly or the names not be either spelled/capitalized correctly.


  334. Hikmer says:

    Have you reolved the Firefox and Safari issues?  It has been a few months and you have had sufficent time to resolve these problems.  Please provide a link to the hot fix or service patch.

  335. says:

    Hello Scott

    The Contact Selector generated by ContentType schema throws AccountId as an integer (which is User Id), it doesn’t gives the username.

    Has anyone come across this issue? I will appreciate if Scott or anyone can help me on this. I am nearly there and just stuck on this problem.

    Thanks in advance.


  336. infopath says:

    Hi kk,

    Is this InfoPath 2007? Also – when does the error occur? I need a little more detail on what you are doing when the error occurs.


  337. gpollock says:

    About the bug in FireFox/Safari… interestingly enough SP2 fixes the peoplepicker control within general SharePoint, like if you add New Users to a group or such. It used to have exactly the same buggy behaviour where it didn’t work in those browsers, and it’s been resolved.

    But looks like the hotfix doesn’t affect where InfoPath renders the control in forms. So even with SP2, you can’t correctly start a Review workflow against a document on the Workflow Initiation Form, as this is rendered by InfoPath. Pity the fix didn’t apply to both instances of the control!

    Scott, I guess we don’t have any idea if they could use that hotfix against the InfoPath version do we? 🙁

  338. infopath says:

    Hi gpollock,

    I am unsure if the same fix could be used in the Contact Selector control that was used in the SharePoint People Picker control. However, although a fix for this did not make it into SP2 it is something we are looking at for our next version.


  339. gpollock says:

    Thanks Scott,

    I presume you mean next version SP3, or possibly hotfix before? Not next version 2010 🙂  (I hope!)



  340. infopath says:

    Hi Gavin,

    "Next version" is 2010 – this is where we are looking to try and correct the behavior.


  341. osama.tamimi says:

    ok.. first fo all thank you.

    my problem is a little strange. i added the contact selector and it works. i click "To…" and i search for the contact and i get results, i select a contact and click add then ok. and BOOM error submitting the form!

    i did not submit the form!! i simply clicked OK after choosing my contact!!

    all that is in the browser form, but on the local machine, also everything works up to the point where i click ok after selecting the contact, then the contact selector turns gray and if i submit the form the corresponding column in the library is empty.

    i need your help on this one and i appreciate it 🙂

    thanks in advance

  342. infopath says:

    Hi osami.tamini,

    If the Contact Selector control turns "gray" then the only time I have seen this occur is when you do not have the data structure setup correctly *or* the node names spelled correctly…including capitalization.

    Please compare the spelling of your node names to what is documented in this blog and make sure they match EXACTLY what is shown here.


  343. osama.tamimi says:

    Hi Scott,

    here is a copy paste of my nodes names:






    i don’t see anything different here. and here is the context file line




    as i said, it does get the search results correctly, and problem happens when i click OK after selecting the contact.

  344. infopath says:


    The "Person" node is not spelled correctly…assuming that was just a typo when you entered here in your comments, then the next step is to make sure you have the node types correct:

    Person – this is a "Repeating Group"

    AccountId, AccountType and DisplayName are just "Field (element)" data types


  345. osama.tamimi says:

    actually no, it was not a typo, it was a copy paste from my elements. and that was the problem. now everything works great

    thank you so much.. i know i look stupid specially that i read most of the comments and not just on this site, but on other and i was telling my self, guys please make sure your elements names are correct before you assume there is something wrong! lol this is really embarrassing.

    anyways, please accept my apologies. and i need your help on something else.

    in the form im creating i need to have multiple contact selectors.


    2-Addressed To.




    i tried to use the same steps here to create a template but when i try to add the Contact Selector activeX controlit says

    "the custom control you have added is not compatible with the form template or template part, and will be hidden in the controls task pane."

    any suggestion!?

  346. infopath says:

    No problem – glad it was that easy! 🙂

    In regard to multiple controls, take a look at my comments from May 22, 2007…


  347. osama.tamimi says:


    that is great, thank you so much.

  348. najerido says:

    Hi Scott,

    I’m new to creating XML files and I have the following error "The ‘Context’ element is not declared."

    I added the control to the form and publish.  When I select the To button, type a name, click Go, and it shows the control searching, then I get an Search failed message.

    Do you have any idea what may cause this?



  349. infopath says:

    Hi Nichelle,

    My apologies for the delay in responding as I was on vacation. 🙂

    Have you resolved the "Context" element error yet? If not, then honestly no, I have not seen this error before. Did you follow the steps in this blog exactly as they appear?

    Also – what version of InfoPath are you using?


  350. namariegaudi says:


    I’m creating a new form and read your article, but when doing the preview and click the "to" button I get a window with no names. I guess I’m not pointing the XML file to the right place. What should the server format be like?

    This is my outlook server:

    Also, does is have anything to do, that I haven’t pubilshed the form yet and that’s why I don’t see any names appearing when I click on the "To" button?

  351. infopath says:

    Hi namariegaudi,

    The URL in the context.xml file needs to point to your "SharePoint" or MOSS server – not an "Outlook" server. So if you want to use your root site collection of your server, the XML file would be as described in this blog:

    <Context siteUrl="http://servername"/&gt;

    However, if you wanted to use a subsite, it would be like this:

    <Context siteUrl="http://servername/site"/&gt;


  352. namariegaudi says:

    Great!!! it works!!!

    One final question though…if I need separate emails fields to be added do I need to redo the steps described above or I can just copy the Contact Selector to other places?

  353. infopath says:

    Hi namariegaudi,

    You cannot just "copy" the contact selector elsewhere and get it to work…take a look at my comments from May 22, 2007 for how to add multiple contact selector controls to one InfoPath form template.

    However, if you just need multiple selections, you may want to look at putting the contact selector control in a "repeating" section or table and then use a custom function to pull all the addresses. For this scenario, take a look at my April 30, 2009 comments.


  354. namariegaudi says:

    I want to create a "workflow" the requestor, enters their email and data for approval along with a first level approver & a second level one. Once the requestor enter all data. I want an email sent to the 1st level requestor either approving the project. If approved, then I want the email going to the 2nd level approver.

    If both values are "approved" then requestor gets an email notification. If at some point 1st or 2nd level approvers reject the data another email will inform the requestor. Can this be done via rules in InfoPath? FYI, I’m not using contact selector for requestor’s email…only for 1st & 2nd level approvers

  355. infopath says:

    Hi namariegaudi,

    Yes – this should be doable using Rules in InfoPath.


  356. namariegaudi says:

    Scott here’s what I did, but it doesn’t seem to work. Need help.

    1. I selected the person group abd clicked on properties

    2. Added a condition that AccountId is not empty. Should it be a condition that AccountId, DisplayName & AccountType shouldn’t be empty?

    3. I setup an Action to submit email via a data connection

    4. My data connection has as receiver the gpContactSelector and I’m sending the form in active view (not as an attachment)

    For some reason when entering a project in the form and saving it in SharePoint the rule doesn’t start and hence no email is sent. Am I missing something?

  357. infopath says:

    Hi namariegaudi,

    I misunderstood how you were doing this…I didn’t understand you were trying to add a Rule to the Contact Selector control. As you can see, that won’t work. Normally what is done is, after everything is filled in the way you want, you have a Rule on a "button" to submit the form, send the mail, whatever. Then in the condition for this Rule, you can make sure that whatever fields are "required", they are not blank.


  358. says:

    Hi Scott,

    I am having a wierd problem and I am kinda stuck. I have got SharePoint DIP in InfoPath bound to a SharePoint content type. Now there is a field of type User in that CType, InfoPath automatically created a people picker, issue is the AccountId stored in this field is the interger id of User Information List and not the account name because the inline type of that field is dms:UserID and not xsd:string. Because its an interger and not accountname I can’t call GetUerprofileWebService. So I tried getting the accountname from UserInformationList using the accountid, however if I lookup a user using people picker and if that user has not accessed the site before he desn’t exist in UserInfo list which means my GetuserProfileService method fails.

    Would you have any workaround for this? I will be very thankful if we can get a workaround for this problem as my system is nearing an end.

    Thanks in advance,


  359. infopath says:

    Hi Kunal,

    The only way I can think of to get this to work in cases where a user has not accessed a site yet, would be to create a custom web service that would take the "Display Name" of the selected user, find that user in Active Directory and then return the associated information about the user that you need. In other words, you would be using your own "custom" process to get the user’s information.

    If not, then the only way I know if is to convert the SharePoint ID of that user to the appropriate account but as you noted, this will be an issue if the user has never accessed the site before.


  360. bcobra says:

    Many of our users have multiple email addresses/user accounts. Is there anyway to get around this error:

    InfoPath cannot submit the form.

    An error occurred while the form was being submitted.

    The form cannot be submitted because some of the e-mail addresses cannot be resolved. If you know the values in the form that specify the e-mail addresses, revise them and try again.

    The following addresses did not resolve in the To line: Bryan

    Is there anyway to point it to look at a particular OU or does it just point to the GAL? The GAL contains everyone worldwide and i want to be able to just have it resolve to our office or local address book.

  361. sbernard says:

    I have read so many of your posts I feel like I know you and I can see that you have been hammered by the contact selector control.  Anyway –

    My question is two fold: After attempting to use multiple controls I realized I am unable to get supporting information.  Meaning the textboxes I am attempting to populate (i.e. Deapartment, WorkPhone) still bring up my info.  My 'hidden' text box does include the requested user's accountid (i.e. domainuser).  I am assuming I am not filtering correctly.  My desk has a permanent dent the size of my head.  Thanks for anything you can suggest – Scott Bernard

  362. Scott Heim says:


    Sorry for the delay in responding…

    So it sounds like you are using the Contact Selector control to select a user then you want to get more information about that user using the GetUserProfileByName web method of the UserProfile web service – is this correct?

    If so, then you will want to verify a few things:

    1) The GetUserProfileByName data connection should not fire when the form first opens unless you need to get information first for the user opening the form

    2) When you click the button to get the details for the user you selected in the Contact Selector control, you need to make sure the first action in your button Rule is "Set a field's value". What you need to do here is set the "AccountId" in the queryField from the GetUserProfileByName data connection to the AccountId field value from the Contact Selector control.

    3) Once you have the AccoundId field populated, then you will query the GetUserProfileByName data connection. This should then return the profile information for the user you selected.

    I hope this helps!


  363. Emily says:

    Hi there, I have created an infopath form using the contact selector and everything works fine when I use in Infopath, however when I try to fill out the form in the browser my form freezes. If I wait I can add a person to the Contact Selector, then I try to add one to the second contact selector and it freezes again.  It is obviously then the contact selector which is making it freeze.  Any ideas? Many thanks

  364. Scott Heim says:

    Hi Emily,

    To the best of my knowledge, I have not seen this behvior before. A couple if things to look at:

    – Are you on the latest Service Packs for Office/InfoPath and for Microsoft Office SharePoint Server?

    – Are you using the latest version of Internet Explorer?

    – Try enabling "Verbose" logging on the server for the "All" category, reproduce the issue and then check the latest log to see if there are any errors getting logged when you try this process

    – You may want to look at using the "Fiddler" network tracing tool to see if you can see what call it is hanging on

    – As a last resort, if you are unable to isolate the cause, you may want to open a support ticket with the InfoPath team to allow them to see the behavior, capture some trace logs, etc.


  365. Yikes, Got a good one. says:

    Hi Scott

    Here's the scoop.

    I have a custom Word Template that contains a custom DIP. That DIP contains

    two contact selectors. They work fine and as expected, however, every once in a while (2 – 7) entries of new documents created by the template crashes Word.

    I've narrowed it down to the contact selector. It will post a message that

    it is accessing the web service and then Word crashes with this error message: faulting module contactpicker.dll

    The DIP is not connected to a SharePoint list and is used only to populate content fields in the template.

    This has got me stumped. Fiddler tells me that the XML is coming back from the webService so I'm sure it's not connectivity. I just can't trap an event to tell me why contact selector has failed.

    Any thoughts would be much appreciated.


  366. RMall says:

    I follwed your instructions to the T, the only confusion I encontered is while creating the Context.xml,  in the XML Context the Servername can it be the actual Exchange server url or has to be the SharePoint site url where the infopath form resides?

    I inserted the SharePoint site URL in quotes ….

    <Context siteUrl=""/&gt;  but when I do the search it is failing.  Gives me Search Failed.

    Any suggestions?



  367. NH says:

    I am new to infopath.  I followed the instructions but upon testing the form, when I do a search for a person I get Search failed.

    I am pointing my Context xml url to my SharePoint main site.  Do I need to point to the SharePoint site that contains the infopath form?  OR can I point to the Exchange Server?

    Any Suggestions?



  368. RMALL says:

    I am new to infopath and I followed the instructions.  But when I do a search for the person I get Search Failed.

    I am pointing to my SharePoint site in the Context xml i.e.

     <Context siteUrl="; />

    Any suggestions why am I getting Search Failed?

    I have a SharePoint Farm with a Main Site and the form is loaded on a Subsite.



  369. Scott Heim says:

    RMall and NH:

    You should enter a URL to the SharePoint site where the InfoPath form will be used…it cannot be an Exchange Server. Now, with that said, the Context XML file is only used when the form is opened in the InfoPath client. If you are using these forms in the browser then it simply uses the site where it is published.

    So with that said, I am going to assume you are using these forms in the browser…if so, what happens if you perform a search for the same user but in a SharePoint screen (i.e. when you need to add permissions for a user) – does it fail there as well or does that work?


  370. Scott Heim says:


    Sorry for the delay…I have not seen an issue like this nor can I reproduce it in the tests I have tried. If you start fresh and have a consistent repro then I would suggest opening a case with the InfoPath Support team so we can take a look at this in greater detail.


  371. contact selector on Infopath 2010 says:

    Hi Scott, the control change event is not functional in browser enabled forms. is this a bug for 2010? thanks

  372. Scott Heim says:


    Regarding the changed event in the Contact Selector control – it appears you are using InfoPath 2010 to create an InfoPath 2007 compatible form template. If this is the case, then yes – the changed event is not available. However, if you create an InfoPath 2010 XSN, then it will be available.

    If you are indeed using InfoPath 2010 to create an InfoPath 2007 compatible XSN, I did try these steps and they appear to work:

    – Change the Compatibility to one of the 2010 formats

    – Add the Changed event and your code

    – Test to make sure it works as you need

    – Save

    – Change the compatibility back to 2007


  373. Sambit says:

    First time it worked for me. I removed the AccountType from it and then search failed. I tried doing it again it failed. I created a new solution and still it does not work. I am going nuts now

  374. Scott Heim says:

    Hi Sambit,

    I am not sure I follow: why would you remove the "AccountType? Can you provide more details on what you are doing exactly to execute a search? Is this from the InfoPath client or from a browser form? InfoPath/SharePoint 2007 or 2010?



  375. Dewan Pavel says:

    Hi, Thanks for your post. This is really a helpful and useful post.

    I have successfully added the control into my form following this article. It works fine in my pc (form development pc) but I have got 'search failed' message from other pc.

    What should I do now?

  376. Scott Heim says:

    Hi Dewan,

    A few questions:

    – Is the other PC a client machine?

    – Are you hitting the same site?

    – Are you logged onto the other machine as the same account you used from your machine? If not, log onto that machine as yourself and make sure it still works.

    – If it works for you and not the other user, does the other user have appropriate permissions? What happens if they just use Internet Explorer, browse to your site and try to do something that requires a search like this (i.e. add themselves to a group, etc.) – does it work directly in SharePoint?

    You also may want to try getting a "Fiddler" trace ( and see if this shows any failure that may help you isolate the problem.


  377. firkeng says:

    Appreciate you sharing stories, are very like your article, hope can continue to post more interesting topics,Now is a fashionable society,[url=…/fake-alexander-wang-644.html]cheap Alexander Wang handbags[/url] also share some interesting gifts.

  378. Todd I. Stark says:

    Is there any additional trick to getting the contact selector control to work on a form that already has digital signature controls on it?  When I add a contact selector to an InfoPath 2007 form that uses digital signature controls and configure the context, the lookups from the control don't seem to do anything.  I'm wondering if there is contact selector logic in the digital signatures or something else that is conflicting with the contact selector I'm adding?

  379. Todd I. Stark says:

    Sorry, that last post was based on an invalid assumption.  It turns out that the digital signature isn't causing the problem afterall.  I removed it and the problem persists.  Clicking on the icon for lookup brings up a dialog and I can select the user from the AD, but it doesn't populate the visible field or allow any subsequent lookups.  I'll check back to the previous responses to see if any of the other suggestions seem to help.

  380. Meghann says:

    I've followed the instructions and was able to make it work, but for some reason when I tried again on a new form

    it doesn't work.  When I preview the form and select "to"  I'm able to search the names from the active directory, but when transferred over to the form, the name won't generate and it control gets grayed out.  Am I doing something wrong?


  381. Scott Heim says:

    Hi Meghann,

    Typically the behavior you are seeing is because one or more of the fields for the contact selector is either not spelled correctly or is not capitalized correctly. Can you please check that the field names are identical to what is in the blog and have the same capitalization?


  382. Meghann says:

    Hi Scott,

    It still doesn't work and I rechecked over and over that it was correct. Any other tips?



  383. Scott Heim says:

    Hi Meghann,

    If the context.xml file is pointing to the correct URL and you have verified the spelling and capitalization of the node names in the data source, then no…unfortunately I am out of ideas. These have been the only cases where I have seen the control get grayed out.

    If you are unable to get this working then you may want to open a support case so the InfoPath team can look into this deeper for you.


  384. how can i use this control to a Sequential process says:

    i want to use the data to a workflow in designer

    how can i seperate the users

    when i try to reach the data, i get only the first user

    any suggestions?



  385. Scott Heim says:

    Hi Dana,

    I am assuming what you are referring to is the behavior you get when you "promote" the Contact Selector node to a column in SharePoint? If so, then try using the "merge" function – this should give you a concatenated result of the users you have selected in the control.


  386. Herlisson says:

    hi Scott, thanks for your blog. I'm from Brazil and I read your posts about InfoPath. I'll try to explain my problem, in english. My form is ok: the activex control searches my users, opening the window users from Sharepoint. But, when I select the user and click on button OK, the message appears: "There has been an error while processing the form". How this is possible?

    The application brings all the users, but it cant put the data in my form.thanks a lot.!

  387. Scott Heim says:

    Hi Herlisson,

    Off hand, I don't know what would cause that error. What I would suggest is to enable "Verbose" logging on your server for the Forms Services categories, reproduce the error and then check the SharePoint ULS logs…hopefully there will be additional details in the logs that point you in the right direction.


  388. Steven Schafer says:

    Scott, 4 years after this was posted, this is the most helpful post for getting the contact in there!

    Thanks again!


  389. Steven Schafer says:

    So after getting the contact selector to work great on one form, I can't get it to work on a second form.  🙁  When I enter my NT id and say search, it greys the box out.  Any ideas?


  390. Steven Schafer says:

    Disregard!  I read further down to a post by Meghan on May 17 and I had the same problem.  Bad spelling/capitalization.  Talk about picky Infopath forms!  🙂

    Thanks again, this is a huge lifesaver!

  391. Terry Lawton says:

    Awesome post.  Here’s a tool that lets you build all types of web forms with email alerts fast and without coding. Just point and click…/web-forms-online.aspx

  392. Brent says:

    If this control could also return users' phone numbers from the SharePoint site, that would be ideal.

  393. bearcheese says:

    hi Scott

    i hope you are still here and can help me 😀

    i have several contact selectors in my infopath form. i have been trying to set default valu for all of them, but it is not working.

    first i was trying it with the resolveprincipal data connection (people.asmx) and add those six rules for each contect selector in the Tools menu choose Form Options -> Open and Save. when it is all done i set the domainusername for all cotact selector's display name and after i publis it to a sharepoint server and create a new document all contact selector are epmty, except those which has my name in it. so i create a new document, i save it, and when i open it all contact selector are empty.

    second i was trying it with the getuserprofilebyname data connection and set all 3 nodes:

    DisplayName – use the PreferredName attribute from the UserProfileService GetUserProfileByName web method

    AccountId – domain name of the user in the form domainusername (can manually concatenate your doman name + + userName() or use the AccountName node of the GetUserProfileByName web method

    AccountType – Just the word "User" is fine if it's a user

    when its done, the contact selector has the domainusername but it does not resolve it.

    please help me. i have been trying to figure this out for 2-3 days and grrrrrr 😀

  394. i think easy to pratice your….. explanation step by step thanks

  395. Scott Heim says:

    Hi BearCheese,

    Sorry for the delay…are you using InfoPath 2007 or InfoPath 2010? And if 2010, are you saving the XSN in the new 2010 format or the 2007 format?


  396. BearCheese says:

    Hi Scott

    Thanks, but i managed to make it work. actually its very easy. all i needed to do was retrieving data from active directory by getuserprofilebyname.

  397. Stuck says:


    I have tried all the steps above with InfoPath 2007. I started from scratch and have nothing else but the contact selector as the only data source.

    When I try to preview the form with the ContactSelector in the View I get

    "InfoPath cannot open the selected form" error message. But when I remove

    it there is no error message.

    Also I believe the ContactSelector control is meant to have a text box with and "To…" button to the left. But in my case it just a small square with a red dot inside of it (looks like a image place holder)

    Please can you tell me where I may have gone wrong? Spent so much time on this, would be grateful for some help.

    Many thanks!

Skip to main content