If you ever wanted to get the version of the SharePoint you are running, you could find it out using the below ways:

Power Shell to the rescue:

If you just wanted to find the version for information purpose you can quickly launch PowerShell and type the below command which will give you the below output:


The Major version gives you the information you need, if its 14 – SharePoint 2010. If its 12 – SharePoint 2007.


If you want to get the SharePoint Version and perform some logic based on that you could use the below code. I have placed the code in a web part. You need to add the Microsoft.SharePoint.Administration; namespace to run this code.

protected override void CreateChildControls()


SPFarm _spFarm = SPFarm.Local;

int version = _spFarm.BuildVersion.Major;

if (version.Equals(14))


this.Title = “SharePoint 2010″;



The above code just checks for the Major Build Version and if its 14 yes we are on SharePoint 2010 and I have just updated the title of the web part using this information.