Udostępnij za pośrednictwem


Open your rolodex from InfoPath using the Contact Selector

Speaking of Outlook integration, Microsoft Office 2007 includes a new control that enables you to choose one or more e-mail address from the address book.

 

You can add this control to InfoPath’s list of custom controls by using the Add or Remove Custom Controls wizard like you would for any other ActiveX control.  When registering the control, you can choose most of the default options. However, you must choose "Field or Group (any data type)" in the "Specify Data Type Options" page of the wizard. If you don't choose this binding type, the control will be disabled when you try to fill out the form.

 

When you insert this control in a form template, it looks like this:

 

 

When you insert this control in design mode, only a group node is added to the data source. You must manually add additional fields in order for this control to work correctly. To determine the final data structure should be, open the properties dialog for the control and click on the "Items" tab. This tab lists the schema structure that is required.

 

As I mentioned, you must manually add these fields to the data source. This can be quite painful if you want to use the control in a lot of form templates. However, here’s a little trick.  You can create a Template Part that contains only the data structure and no controls in the view. Now, when you need to use the Contact Selector, first insert the Template Part to create the data structure.  (This will insert an empty Section control into the view which you can then remove.)  Then, go to the data source, right-click on the group node that was inserted, and select Contact Selector from the More menu.

 

Template Parts don't support ActiveX controls so you can't insert the Contact Selector into the template part which would make this even easier. However, using this empty template part that contains only the data structure is still easier than creating the structure from scratch each time.
 
Scott Roberts
Senior Development Lead

Comments

  • Anonymous
    September 22, 2006
    Hey Scott,

    Using these tips I was able to add the Contact Selector to an InfoPath form and avoid having to write my own custom look-up. However, I'd like to add validation logic similar to the logic being done on the ReviewRouting_1033.xsn forms deployed with SPS '07 with the Approval workflow.
    How can I place validation on Group nodes? This appears to be the approach used in the ReviewRouting
    _1033.xsn forms, but is normally disabled on Group nodes.

  • Anonymous
    February 06, 2007
    To jiwasz: one way this can be done is by using code. There’s a Validating event available for all group nodes; in the event handler, you can check for some condition and add an item to the Errors collection, if necessary. Another option is custom-designing an XSD schema, and then starting an InfoPath form template from that XSD. InfoPath will respect your schema restrictions. Thanks, Alex

  • Anonymous
    May 08, 2007
    Any idea why I would be getting this error when publishing to MOSS: The SOAP response indicates that an error occurred on the server: Server was unable to process request. ---> Object reference not set to an instance of an object. -I've followed all of MS' implementation steps for this control. Thanks, Mindy

  • Anonymous
    August 01, 2007
    I'm sorry, I'm quite new to InfoPath development, but I believe this is exactly what I'm looking for and I don't really understand how to do it.  I see how to add a custom activex control, but it just gives me a huge list of controls and I have no idea which one to choose.  I'm sorry if I'm missing something above, but I do not see it. Regards, Brian

  • Anonymous
    August 08, 2007
    Hi Brian, This is an InfoPath 2007 control and should be listed in the ActiveX controls as "Contact Selector." Scott

  • Anonymous
    July 02, 2008
    UsingtheContactSelectorControl Wehaveseenanumberofrequestsonhowtoallowausertoen...

  • Anonymous
    January 12, 2009
    UsingtheContactSelectorControl Wehaveseenanumberofrequestsonhowtoallowausertoen...

  • Anonymous
    February 02, 2009
    UsingtheContactSelectorControl Wehaveseenanumberofrequestsonhowtoallowausertoen...