开发者

Creating Custom List Definition using VS 2010 without creating Custom Content type

I want to create Custom List Definition without creating custom content type. Way I followed is created farm solution without list instance -> In the elements.xml file I gave 10005 as a type and in the Schema.XML in the section I added custom fields and also in the default view as well. When I deployed this project and created list based on this definition and clicked on the "New Item" it didnt show Custom Columns but only the Title Column. To solve this I removed whole content type section from the Schema.XMl and deployed the solution again. I created list based on the List definition this time clicking on the "New Item" link in the list view it shows all the custom columns but when I go to ribbon and click on the "New Item" drop down it does not show "New Item" but it shows the name of the list instead and also it adds the name 开发者_C百科of the list as a content type. I can understand this behaviour as I removed content type section from the Schema.XML but how can I add custom columns to Item Content type ?


In the Schema.xml file you need to:

  1. Declare the fields inside the Fields node (the same way you would if you were creating site columns)
  2. Update the default view to show the newly created fields (if necessary)
  3. Delete the ContentTypes node

I cover this in detail in the Creating Lists using CAML module of my Pluralsight SharePoint 2010 Lists and Libraries for Developers course. You could watch it using a trial subscription.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜