In this blog I’ll explain how to create a custom list definition in SharePoint 2010 that contains the following parts;
Next you need to arrange default view of the list. Add FullForm field as FieldRef element to the default view element. You can deploy the project to your SharePoint and create lists from the custom list definition. UPDATE: This blog had to be updated according to the comments. I’d like to thank Ozan Bora Fikir for contribution. It’s a good practice to seperate the features of list instance and its definition. In this case you have to make sure that list definition feature is activated before the list instance feature. Cannot complete this action. Please try again! You might get this self-explanatory (!) exception while trying this example. Here is the solution that Ozan submitted.
- creation of custom fields and a content type for the list
- creation of list definition
- creation of a list instance
This is a very helpful description for an exception, but I found root of this problem. First of all, we need to understand the behaviour of SharePoint for content types. Let’s assume that we create a custom site content type. We have to choose a base content type for out newly custom site content type. Further assume that you’re going to use your custom content type in a custom list definition. In your custom list definition you need to add to the list element EnableContentType=”TRUE” attribute. But your list do not directly use your site content type. It redefines your custom site content type as a “list content type”. Since you define a ContentTypeRef. Now the problem, as in your example, is that you just rename a column of the your “list content type”. These are “Title” as “Abrreviation” and “LinkTitleNoMenu” as “Abbreviation”. This is the cause of the problem. “Title” column inherits from the Item Content Type. But SharePoint does not found your renamed field. So you have to refine your content type schema, modify the attribute Inherits=”False”.
Trackback from your site.