Determine SharePoint server version using Client object model

 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]

Share

Add Your Comments

Your email address will not be published. Required fields are marked *