Visual Studio 2012 SharePoint 2013 List and Content Type Designer: Hands-on Observations

After spending some time on developing a SP Hosted App, I would like to share my insights and observations with the new Office Developer tools for SharePoint 2013

Prerequisite: Web Platform Installer > Microsoft Office Developer Tools for Visual Studio 2012

Let’s walk through my observations from site columns, to content types and to list definitions.

Site Columns

  • There is no visual designer. Content types reference site columns and so having a site column designer would make much sense. It is unfortunate that one is absent.
  • Therefore, creating site columns is manual through the elements.xml file

VSContentTypeDesigner-1

Field Element Schema
http://msdn.microsoft.com/en-us/library/ms437580.aspx

Content Type

  • There is a new visual designerVSContentTypeDesigner-2VSContentTypeDesigner-3
  • Add existing OOTB site columns
  • Add existing custom site columns that were manually created.VSContentTypeDesigner-4
  • Remember, you cannot create custom site columns in the content type designer.
  • Limitation: Column ordering is manual through the elements.xml definition files. In other words, you cannot reorder site columns in the conten type designer.
  • Gotcha: Change in custom site column definition does not automatically reflect changes in content type. For example, changing site column name will break the referring content type.
    Therefore, you must remove the custom site column and then add updated site column.

List Definition and Instance

  • There is new visual designer
    Able to set List (template) name, url and description.
  • Content Types. Add existing OOTB content type or custom content type created in the VS projectVSContentTypeDesigner-5
  • Columns
    Add existing OOTB site columns or
    existing custom site columns in the VS project
    VSContentTypeDesigner-6Add list level columns manually
    VSContentTypeDesigner-7
  • Limitation: When creating a new custom column that are more complex in nature such as choice or person, there is no ability to configure the selectable choices. I would think you would have to revert to the xml files and fill in the rest of the xml manually. Having such a site column designer would have been very convenient.
  • When creating a list column, it automatically creates a list content type called “ListFieldsContentType” if one does not exist. This becomes the default. Any further site columns (OOTB or custom) added will be automatically added to this ListFieldsContentType content type.
    VSContentTypeDesigner-8
  • Note: Changes in content types referenced by the list definition are not automatically reflected. This is the same scenario mentioned above with site columns referenced by content types. So after you change a referenced content type, you must remove and then add back the updated content types to the list definition.
  • Set default content type so that the list’s ‘new’ button refers to the content type desired.
  • Limitation: List column ordering is manual through the xml definition files.
  • Not able to add predefined data rows in List Instance
    In ListInstance elements.xml, I added
    <DataRows>
    <Row>
    ….
    </Row>
    </DataRows>
    This resulted in a deployment error. Maybe I am missing something, but I was unsuccessful.
  • Views
    Able to specify which columns appear in the view and their order, row limit, read only, but nothing more than that. For example, no sorting ability, grouping, filtering, etc.
    VSContentTypeDesigner-9

After deploying to site collection:

VSContentTypeDesigner-10

Deployment Error: Failed to install app

Possible causes:

  • The xml schema files are malformed or have a syntax issue. Visual Studio can detect and highlight some of these in the Error pane.
  • A custom element definition is in conflict with an element already existing in the SharePoint farm.
    For example, deploying a list, content type or site column that has the same internal name as an existing artefact. Duplication error.

Troubleshooting:

The way I troubleshoot, is to remove snippets of xml definition and re-deploy to isolate trouble area.

I have looked in the 15 ULS Logs to find any detailed error messages and did not recognize anything helpful.

Conclusion:

The designers are a welcomed feature in Visual Studio 2012 for SharePoint developers. However, more can be achieved with site columns and handling changes to referenced elements. This is probably a large effort, since there are so many types of site columns with varying complexities such as ‘People and Groups’ and ‘Managed Metadata”. Nevertheless, it is one step better in getting through the xml hell.

Appreciate any comments and feedback.

References:

Walkthrough: Create a Site Column, Content Type, and List for SharePoint
http://msdn.microsoft.com/en-us/library/ee231593.aspx

Advertisements

4 thoughts on “Visual Studio 2012 SharePoint 2013 List and Content Type Designer: Hands-on Observations

  1. Pingback: How to create a custom SharePoint list definition using Visual Studio 2012 | Cameron Dwyer | SharePoint, Outlook, OnePlaceMail

  2. I’ve given up on the designers in Visual Studio. So much easier to build in Web UI or SPD. Then export site and import the .wsp into Visual Studio and pluck what I need and put into my own Visual Studio project.

    • I can agree. I sometimes do the same “advanced” type of approach in building site columns and content types and then pulling the straight xml definitions into the elements.xml in the visual studio project.
      I would say the designer approach is a starting point for beginners in SharePoint development.

  3. There is way to sort and grouping in the properties window,when you select the view. But I dint find any way to filter columns.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s