This is a quick fire blog that will enable you to create a custom list with code in Visual Studio

Creating a Custom List with code in Visual Studio

I am trying to document the whole life cycle of creating and developing everyday tasks via code within SharePoint, this blog we will go step by step on creating a list via code in visual studio.

Step One

  • Create a new Empty SharePoint Project

Step Two

  • Enter your site URL and select a farm Solution

Step Three

  • Right click on the feature and add feature > Make it web Scoped > and then right click the feature and rename it to something meaningful

Step Four

  • Right click on the feature and then add Event Receiver

Step Five

  • In the event receiver uncomment the FeatureActivated and the FeatureDeactivating methods and you can remove the rest

Step Six

  • inside the FeatureActivated add the following code or something that makes more sense to the environment you are in.

Step Seven

  • in the FeatureDeactivating add the following code

Step Eight

  • Go to the properties of the project and the SharePoint Tab under active Deployment Configuration select No Activation (this means that you will need to activate the feature manually).

Step Nine

  • Go to Manage Site features within settings and activate the feature

Step Ten

  • go to your new list item