SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a site column in VS2010 without using features. Is this possible? If yes, please let me know where I can start looking.

I don't want to use feature because feature comes with its own maintainability headache which I want to avoid as much as possible. I want to be able to individually install/update/delete each site column that I create in any given environment.

share|improve this question
Another way is to use SharePoint APIs and do it using code. – Ashish Patel Jul 5 '11 at 17:52
Ashish, could you suggest a web-site or a textbook that can help me go down this path? Thank you. – Sam Patrick Jul 5 '11 at 18:36
up vote 2 down vote accepted

If you are just trying to avoid using declarative xml to create the column, you can write C# code to create the column. But to deploy to your site through a wsp, it will still need to be packaged in a feature.

You could write a console application that runs on the server and executes the code to create the column. However, this seems like more of a maintainability headache than creating a feature.

Either way, the code would look something like this:

using(SPSite site = new SPSite("url-of-your-site"))
  using(SPWeb web = site.RootWeb)
    web.Fields.Add("ColumnName", SPFieldType.Text, true);

You could also create a Powershell script to add the column. Something like:

$site = Get-SPSite "your-site-url"
$web = $site.RootWeb 
$column = '<Field Name=...' +
                 'ID=...' +
                  etc. +

But, really features aren't that bad once you accept that feature activation is the way to programmatically add elements to a SharePoint site.

share|improve this answer
Laurie, thank you for your answer. This is very helpful. I think I will give the console app a try. The reason I am not very happy about features is because I cannot delete one site column or content type from a given featuer - hence, as an end user I dont have much control over my own artifacts. The same issue will arise during upgrades for me as a developer. – Sam Patrick Jul 5 '11 at 18:54

You can create columns in three ways:

share|improve this answer
I have created the columns using both the UI and Features. But since both these approaches are kind of rigid per maintainability, I would like to try the Object Model. To that end, I have not found a definitive guide that can help me jump start this project. – Sam Patrick Jul 5 '11 at 18:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.