Tuesday 28 May 2013

How to Add fields(Columns) in list definition ? Part III

2. We should add the following line in list definition elements.xml then change the content type id as a concat 0x0100 with new guid.(note: removed '{}' & '-') and then fieldref id is your own created field(column) id.

<ContentType ID="0x0100560CF9639C39489B845C07ED8116F6F1" Name="CutomAsaiType" Group="Custom CT" Inherits="FALSE" Description="">
    <FieldRefs>
      <FieldRef ID="{9FDF6527-1072-4751-8B15-84CA97AE7CBA}"/>
    </FieldRefs>
  </ContentType>

3. Replacing the following code in schema.xml
<ContentTypes>
      <ContentTypeRef ID="0x01">
        <Folder TargetName="Item" />
      </ContentTypeRef>
      <ContentTypeRef ID="0x0120" />
    </ContentTypes>
  With

<ContentTypes >
      <ContentTypeRef ID="0x0100560CF9639C39489B845C07ED8116F6F1">
      </ContentTypeRef>
    </ContentTypes>
and then change the contenttyperef id as your own list definition content type id.



4. Add the created field in view, the following way:-

<FieldRef Name="Name"></FieldRef>

 


Now you can able to deploy successfully and then you can see the list with field on the site.

If it is getting error like "A duplicate field name "Name" was found",
Solution1: You should change the field Name on list definition elements.xml, schema.xml & view and then add the same as a static name in list definition element.xml & schema.xml.

After that you are getting same error once agin,
Follow the Solution1 and then change field id as new guid.

There after you are getting error, please let me know.

12 comments:

  1. Thank you for sharing such wonderful content on Sharepoint it's very informative.

    ReplyDelete
  2. I found your blog very interesting and very informative. I think your blog is great information source & I like your way of writing and explaining the topics. Microsoft SharePoint is a web application platform developed by Microsoft. First launched in 2001, SharePoint has historically been associated with web content management and document management, but recent versions have significantly broader capabilities. If you Want More Details About Sharepoint Click here.

    ReplyDelete
  3. Thanks for delivering a good stuff related to SharePoint, Explination is good, Nice Article.
    SharePoint Online Training

    ReplyDelete
  4. Good article. I was looking for the benefits of backlinks and comes to your site.
    SharePoint Migration Tool
    SharePoint Migration
    Saketa Migrator - The best SharePoint migration tool, helps you migrate data from all online SharePoint versions, Office 365 migration software and cloud.

    ReplyDelete
  5. Very informative post....!

    How to Add fields(Columns) in list definition ? Part III

    will try this..!

    Top 8 Important Skills to Learn To Become a SharePoint Developer

    Hire sharepoint developers

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete

  7. I discovered your blog to be both engaging and highly informative. I find it to be an excellent resource, appreciating your style of writing and how you articulate various topics. Microsoft SharePoint is a web application platform created by Microsoft. Initially introduced in 2001, SharePoint was primarily linked with web content and document management. However, more recent versions have greatly expanded its capabilities.

    ReplyDelete