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.
- 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
- For a point of reference, you can follow the link to help create site columns manually.
Field Definitions Samples
Field Element Schema
- 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 project
Add existing OOTB site columns or
existing custom site columns in the VS project
Add list level columns manually
- 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.
- 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
This resulted in a deployment error. Maybe I am missing something, but I was unsuccessful.
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.
After deploying to site collection:
Deployment Error: Failed to install app
- 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.
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.
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.
Walkthrough: Create a Site Column, Content Type, and List for SharePoint