Home > SharePoint > Getting the Version of SharePoint Installed

Getting the Version of SharePoint Installed

I am not discussing about something which seems to be rocket science , Though ,being through many blogs , i saw some people are getting these things from system registry. But what if the system is upgraded with SharePoint 2010 and previously MOSS was installed ?.

The easiest way to get the installed version , whether it is WSS , SharePoint Foundation , MOSS or SharePoint 2010.

You need to add the SharePoint assembly reference first.

using Microsoft.SharePoint;

using Microsoft.SharePoint.Administration;

Then simplest way to get the version in.

string SharePointVersion = SPFarm.Local.BuildVersion.ToString();

Happy coding 🙂

Advertisements
  1. Shafaqat Ali
    February 21, 2012 at 2:58 pm

    nice one, keep it up.

  2. Syed Shoaib Adil
    July 9, 2012 at 12:21 am

    SPFarm.Local.BuildVersion.ToString();

    this line would return same value for MOSS or WSS and same value for Foundation and SP2010…am i right?

    How can i differenciate between MOS or WSS from ur given line results?

    • July 9, 2012 at 1:44 pm

      It gives you buildversion of WSS , as even WSS is used by MOSS as base , If Foundation 2010 is installed then it will give you string starting with “14” , and if WSS then string starting with “12”.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: