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

Creating a document library with code in Visual Studio

In this post we carry on the everyday task series with creating a document library through code and via 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 change where needed to.

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 document library item


  • You will need to add the Microsoft.SharePoint.Security.dll reference to your solution.

  • plus add it as a using reference