Using InfoPath 2010 To Create A Custom Content Type In SharePoint 2010
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
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.
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.
We will build our form from scratch.
Click the Design Form Button on the right side of the screen.
This will take us to the design a form screen.
Add a title to the form by clicking the words 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.
Click on the Insert Tab, choose a pre-formatted table style and click it which will insert a table into the form.
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.
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.
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.
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.
Notice the Fields window.
Click the drop down in the 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.
Notice the form changes to reflect the changes.
Repeat the process above for the 2nd row 2nd column but this time use 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.
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.
Leave the default checkbox of Enter choices manually and click on the Add button.
Add the items: operations, hr, sales, marketing and warehouse to the drop down list.
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.
Add the Date and Time Picker Control to the Begin Date and End Date Rows.
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.
At this time I will go ahead and 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
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 the Enterprise site features are activated. Site Actions > Site Settings > Manage site features
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.
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.
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.
Leave the default: Create a new content type and click Next.
Type a name and description for your content type, then click Next.
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.
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.
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.
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.
When all the fields have been added and or mapped, you can click the Next Button.
Verify the form settings and if correct click the Publish button.
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.
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)
Verify the creation of Last Name and Departments site columns.
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.
Give the form a file name, hit save, then hit close on the form and it will appear in the Day Off Request Library.
All done! (I modified the default view to show the columns from the form).
You May Also Like
In this Office 365 training video, instructor Spike Xavier demonstrates how to create users and manage passwords in Office 365. For instructor-led Office 365 training classes, see our course schedulle: Spike Xavier SharePoint Instructor – Interface Technical Training Phoenix, AZ 20347: Enabling and Managing Office 365
In this SharePoint training video, I want to talk about the Navigation Controls in SharePoint. They tend to fall into two kind of different categories; one with the navigation controls in a typical Collaboration Site such as a Team Site or a Project Site. These are Sites that are based on the Team Site Template … Continue reading Using Navigation Controls in a Collaboration Site in SharePoint
For more SharePoint training videos in this series, see: Part 1 – Using Navigation Controls in a Collaboration Site in SharePoint Part 2 – » Using Navigation Controls in a Publishing Site in SharePoint « Part 3 – Configuring SharePoint Navigation in a Publishing Site – Activating the Publishing Feature Part 4 – How to Configure Navigation in SharePoint … Continue reading How to Use SharePoint Navigation Controls in a Publishing Site