Search This Blog

Wednesday, December 24, 2014

Creating Custom Field Items for SharePoint Lists in Visual Studio 2010


Introduction

This article explains on creation of custom field items for SharePoint Lists in Visual Studio 2010. This field item can be used as fields in SharePoint lists.

Background

I was working on large SharePoint projects and there was a requirement to create huge number of lists and libraries with lot of fields and content types. As per the customer requirement and best practice, we have to come up with our own field items rather than using the default ones. Finally created the custom fields for SharePoint lists in Visual Studio 2010. Hope this article would help you in crating custom field items for SharePoint lists.

Implementation Steps
  • Open Visual Studio 2010 and click on 'New Project' option.
  • Select 'Empty SharePoint Project' in the template pane and change the name of the project that you would like to have it.

  • Specify the site and security level for debugging.
  • Select trust level as 'Deploy as a farm solution'. You can select trust level as 'Deploy as a sandboxed solution' option also.
  • Click 'Finish'. You should see project in the solution explorer.
  • Right click on solution explorer and then click on 'Add New Item' option.
  • Select 'Empty Element' in the template pane and click 'Add'.

  • Open Elements.xml file and add the below fields.
    • Employee Id (Number)
    • Employee First Name (Single line Text)
    • Employee Last Name (Single line Text)
    • Employee Initial (Single line Text)
    • Employee Role (Single line Text)
    • Is Active (Boolean)
        See the below image for more information.



          That's it. Compile the project and deploy the solution.

Verification Steps
  • Go to SharePoint site.
  • Go to Site Actions -> Settings
  • Select 'Site Columns' option under 'Galleries' section




No comments:

Post a Comment