Determine SharePoint server version using Client object model

  • Posted by: Softree Technology

 Get SharePoint server version using client object model.

To determine which version of SharePoint you are currently using, by client side object model

Example:-

[code lang=”c”]
Class Program

{

static void Main(string[] args)

{

using (ClientContext ctx = new ClientContext(“siteUrl”))

{

string version = string.Empty;

ctx.ExecuteQuery();

version = ctx.ServerVersion.ToString();

if (version.StartsWith(“14.”))

version = “SharePoint2010”;

else if (version.StartsWith(“15.”))

version = “SharePoint2013”;

else if (version.StartsWith(“16.”))

version = “Office365”;

Console.Write(version);

}

}

}
[/code]

Author: Softree Technology

Leave a Reply