Using InfoPath 2010 To Create A Custom Content Type In SharePoint 2010

In this blog we will go through the process of using InfoPath Designer 2010 to create a custom content type in SharePoint 2010. You must have SharePoint 2010 Enterprise version with Forms Services configured for this to work.

Our Team Site

Our Team Site SharePoint 2010

We have created a New Site Collection and chose a standard team site template as the top level site. We customized it just a little to dedicate this blog post to the members of the Arizona SharePoint Users group (azsharepointpros.com). We have also changed out the standard photo for a color scheme snapshot from kuler.adobe.com (the greatest color scheme program ever written).

We will now open InfoPath 2010 Designer.

Info Path 2010 Designer

Make sure to choose Microsoft InfoPath Designer 2010 not Filler.

We will be creating a content type and a form for adding an item of this type to SharePoint 2010 at the same time!

This content type will be a simple time off request. We will need 5 columns:
firstName – text
lastName – text
department – text from choice (operations, hr, sales, marketing, warehouse)
beginDate – date
endDate – date

Select Blank Form in the InfoPath 2010 Designer Available Form Templates screen.

Blank Form in Info Path Designer 2010

We will build our form from scratch.

Click the Design Form Button on the right side of the screen.

Design Form Button

This will take us to the design a form screen.

Add a title to the form by clicking the words Click to add title.

Click to add title

I added the text 'I need a day off' but you can add anything you like of course.

Click on the words Add Tables.

'I need a day off

Click on the Insert Tab, choose a pre-formatted table style and click it which will insert a table into the form.

Click on the Insert Tab Info Path Designer 2010

This will change the ribbon to be contextual to adding or inserting a formatted table. Go ahead and select one of the styles from the ribbon by clicking on it. I chose the one highlighted in the image however you can choose any one.

The table will be inserted into the form. By default there are only 3 rows and we need 5. Place the cursor inside the last row and right click and choose rows below.

right click and choose rows below

Repeat the step above with your cursor in the last row. You now have 5 rows.

Add the labels by simply clicking the word Add label and replacing it with the appropriate label.

Add the labels Info Path Designer

These are simply labels not field or column names although they do map one to one in this case. When we add the controls in the next steps we will use the names which will become the site column names.

Click the Home tab to put the ribbon into the proper context then click in the first row, second column and click the Text Box control to add a text box.

Text Box control to add a text box

Since the firstName is a text data type, a text box is the proper control to collect this information.

A text box is added to the form and the default name is field1. We need to change this to firstName which we will do in the next step.

field1

Notice the Fields window.

Click the drop down in the Fields window for field1 and choose properties.

Fields window for field1 and choose properties

This will open the Field or Group Properties Window.

Change the Name from field1 to firstName then click the OK button.

Change the Name from field1 to firstName

Notice the form changes to reflect the changes.

Repeat the process above for the 2nd row 2nd column but this time use lastName.

lastName

When you're done your form should look like the image above.

Add a Drop-Down List control to the third row second column for department.

Add a Drop-Down List control Info Path Designer

Now use the drop down menu in the Fields window to change the title to department.

Add items to the drop down menu. Right click on the Drop Down List and choose Drop Down List Properties.

Drop Down List Properties

Leave the default checkbox of Enter choices manually and click on the Add button.

Add button

Add the items: operations, hr, sales, marketing and warehouse to the drop down list.

Add the items

Repeat this for each value.

Set the default value. If the initial choice Select… does not have the Default value of yes, highlight it by clicking on it and click the Set Default button.

click the Set Default button

Add the Date and Time Picker Control to the Begin Date and End Date Rows.

Add the Date and Time Picker Control

Click in the second column of each of the Begin Date and End Date Rows and click on the Date and Time Picker control to add them.

Change the names from field4 and field5 to startDate and endDate.

Change the names from field4 and field5

At this time I will go ahead and save the form.

save the form

I saved mine to my desktop.

Confirm the feature settings of the target SharePoint Site. Site Actions>Site Settings>Site Collection Features

Confirm the feature settings of the target SharePoint Site

If you don't see Site Collection Administration you might not be a Site Collection Administrator. If you see Go To Top Level Settings you are not on the top level site of the Site Collection and you should be there for this purpose.

Verify that the SharePoint Server Enterprise Site Collection features are set to Active.

Verify that the SharePoint Server Enterprise Site Collection features

Verify the Enterprise site features are activated. Site Actions > Site Settings > Manage site features

Verify the Enterprise site features are activated

Verify Active status.

Verify Active status

In a normal out of the box installation of SharePoint 2010 Enterprise edition, when you create a Site Collection and choose Team Site as the top level site template these settings should all be configured correctly but it's always prudent to check.

Back to InfoPath 2010 Designer to Publish the Form. Click on the File tab and then click Publish your form.

Info Path 2010 Designer to Publish the Form

From the Publish screen click on SharePoint Server.

From the Publish screen click on SharePoint Server

This starts the Publishing Wizard, type in the address you would type in the browser window to go to the site, then click Next.

Publishing Wizard

Verify that you have the 'Enable this form to be filled out by using a browser checked and select the radio button: Site Content Type (advanced) as shown then click Next.

Site Content Type advanced

Leave the default: Create a new content type and click Next.

Create a new content type

Type a name and description for your content type, then click Next.

name and description for your content type

I named my content type timeOffRequest.

SharePoint needs to know where you want to store the form template. I have chosen the SiteAssets Library so I enter a path to that location and hit Next.

SiteAssets Library

Here is where I will add all of the fields in the form to be Site Columns. To do this I click Add and choose the fields. In the case of our form it will make sense to map our fields to existing Site Columns. InfoPath Designer 2010 and SharePoint make this very easy.

fields in the form to be Site Columns

When we choose firstName, Info Path Designer 2010 and SharePoint understand that we probably want to use the existing Site Column First Name which is in the Core Contact and Calendar Columns group.

Calendar Columns group

This will happen for each of the fields in the form, except lastName and departments. A new site column Last Name and a new site column Departments will be created and placed into the Microsoft InfoPath site column group.
firstName maps to First Name from teh Core Contact and Calendar Columns
lastName (new site column Last Name is created) and placed into the Microsoft InfoPath site column group.
departments (new site column Departments is created) and placed into the Microsoft InfoPath site column group.
startDate maps to Start Date from the Base Columns Group.
endDate maps to End Date from the Base Columns Group.

The image below shows the departments field from our form not finding an existing Site Column match, so a new one is created. The same thing happens for lastName.

departments field

When all the fields have been added and or mapped, you can click the Next Button.

all the fields have been added

Verify the form settings and if correct click the Publish button.

Verify the form settings click the Publish

When you click publish you will see a couple of modal windows and then hopefully success!

When complete you can either click Close, or the link Manage this Content Type or Open this form in the browser. I'll click close.

Manage this Content Type

At this point I also close Info Path Designer 2010. Then I go to my Site.

I'll take a look at the Site Column Gallery to verify the creation of the new site column Departments. Site Actions > Site Settings > Site Columns (Under the Galleries section)

Site Column Gallery

Verify the creation of Last Name and Departments site columns.

Last Name and Departments site columns

Test the new Form and Content type.

Test the new Form and Content type

I created a library called dayOff and then set it up to manage its own content type and use our new timeOffRequest. If you are not sure how to do this, there is a step by step tutorial blog on creating content types at this url: Creating a Custom Content Type in SharePoint 2010.

Time to fill out the form. Too bad Beethoven's music career didn't work out but he's great on a forklift.

fill out the form

Give the form a file name, hit save, then hit close on the form and it will appear in the Day Off Request Library.

Give the form a file name

All done! (I modified the default view to show the columns from the form).

modified the default view

This blog shows how to Use InfoPath Designer 2010 and SharePoint 2010 Enterprise with Forms Services configured to create a custom content type.

Enjoy!
Spike Xavier
SharePoint Instructor – Interface Technical Training
Phoenix, AZ

 

Posted in SharePoint | Posted in , , , , , , | 7 Comments

Your Feedback: (7 Responses)

  • bob elander says:

    Golden, thanks for posting this

  • John says:

    Very nice but I'm confused by this instruction from above:

    The image below shows the departments field from our form not finding an existing Site Column match, so a new one is created.

    I interpreted this to mean that a site column group named "Microsoft Office InfoPath" should be created (i.e. it is not on my system OOTB) so I did that adding some column to complete the dialog (I chose "ArbitraryID"). Then when selecting the "departments" field from Site column group: Microsoft Office InfoPath, the column name is a dropdown showing ArbitraryID only (i.e. cannot type "Departments" which I infer you to mean this would create a new site column in this manner). In short, the only way this appears to work is if "Departments" is previously created as a site column within the site column group "MS Office InfoPath". Have I misunderstood something here or did you imply that the department site column would be dynamically created within that group somehow? 

  • tanweer says:

    really a good post, thanks,

  • tanweer says:

    he dude, it is great article and it really helped me:)

  • BGM says:

    How do you get around having to specify a filename?  What if I want the form to work like a list form – when the user fills it out and clicks okay, it goes into a list.  I know you can do that with content types and lists, but can you do it with an infopath-built content type?

  • Greetings,
    You must have SharePoint 2010 Enterprise version with Forms Services configured for this to work
    Thanks
    Interface Technical Training

  • Konstantin says:

    Spike,

    Great tutorial! I followed it step by step and it worked flawlessly.

    Best regards,
    Konstantin

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">