A quick look at the content type editor in Visual Studio 11
Posted
Monday, February 6, 2012 10:52 AM
by
CoreyRoth
Visual Studio 11 introduces a new content type editor that you might find useful when building your next content type. It starts with a SharePoint Project Item that you can pick from the New Item menu.

From this screen, give your new content type a name and then you’ll be presented with this next screen allowing you to pick a content type to inherit from. This pulls a list of every content type currently on the site collection that you have your Visual Studio project associated with.

Pick the content type you want to inherit from and you will then see the new content type editor.

From here you can begin adding exiting site columns to your new content type.

Selecting one will bring over the type automatically. Unfortunately the only option you get here is whether the column is required or not. However, you can click on the elements.xml file in the solution explorer to edit the XML directly. I’ve tested and it will preserve any additional attributes you add to your site column references there.

You might be wondering what about site columns that have not been created yet. The editor is actually smart and knows to look at any site columns defined in the same project as well. For example, I created this new site column below.

Unfortunately, creating site columns still requires XML, but Visual Studio at least gets you started. After you save your new site column, you will find the site column in the list.

You can also set some of the common properties such as the group and description of the content type itself by clicking on Common Properties.

What about inheriting from your own content type in the same project? That actually works as well. However, you will have to look for it at the top of the content type list.

That’s a quick look at what Visual Studio offers for content type editing. I think the SharePoint Designer still has a few more features, but the main difference is what you create here can actually be deployed elsewhere. This will work with SharePoint Online as well. Just use the new publish feature I have talked about earlier.
For more information on Visual Studio 11, go to the Developer Preview site.