SIGN UP MEMBER LOGIN:    
ARTICLE

How to create Custom SharePoint 2010 List Column using Visual Studio 2010

Posted by Vijai Anand Articles | SharePoint November 17, 2010
In this article we are going to create custom column using visual studio 2010.
Reader Level:

In this article we are going to create custom column using visual studio 2010.

Steps Involved:

Creating Empty SharePoint Project:
  • Open Visual Studio 2010.
  • Go to File => New => Project.
  • Select 2010 from the installed templates SharePoint and choose Empty SharePoint Project.
  • Name it as CustomColumn.

    1.gif

  • Click Add.
  • Enter the SharePoint server farm URL.
  • Select 'Deploy it as a Farm Solution".
  • Click Finish.
Adding an Empty Element:
  • Right click the Solution Explorer and select Add a new item.
  • Select Empty Element from the installed templates SharePoint and name it as CustomColumn.

    2.gif

  • Double click the Elements.xml file.

    3.gif

  • Replace the code with the below one.

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
              <Field ID="{4678C6A2-F296-432C-A4CA-8C4D96DA6B46}"
                     Name="CustomColumn"
                     DisplayName="Custom Column"
                     Type="Text"
                     Group="Custom Columns">
              </Field>
    </Elements>
  • In the above code, we are adding a custom column with the Type "Text" and with the group name as "Custom Columns".
  • Build the solution.
  • Deploy the solution.
Testing:
  • Go to the SharePoint site.
  • Go to Site Actions => Site Settings =>Galleries =>Site Columns.

    4.gif

  • You will see the custom column that we have created in the group "Custom Columns".

    5.gif

Login to add your contents and source code to this article
share this article :
post comment
 

How can I add the Custom SharePoint 2010 List Column to DefaultView "All Documents" (AllItems.aspx)? I want do this declarative. Is it possible that I can define this within the field element with an attribute? For example Viewable="TRUE" (Optional Boolean. TRUE to specify that the field is added to the default view. The default value is TRUE.) doesn't work. Thx in advance. Manfred

Posted by Manfred Dec 27, 2010
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Nevron Gauge for SharePoint
Become a Sponsor