BlogPost

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

Creating a Content Type with code in Visual Studio



This is the second post in a serious of the creating and developing everyday tasks series that we will go through on how to create a content type via code within 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 Site 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 Site settings > site columns and see what you have created