public enum CRMVersion
{
Unknown,
CRM2011,
CRM2011UR12PLUS,
CRM2013,
CRM2013SP1,
CRM2015
}
public CRMVersion GetCRMVersion(IOrganizationService service)
{
RetrieveVersionRequest versionRequest = new RetrieveVersionRequest();
RetrieveVersionResponse versionResponse = (RetrieveVersionResponse)service.Execute(versionRequest);
string version = versionResponse.Version;
if (version.StartsWith("5"))
{
try
{
int buildNumber = Convert.ToInt32(version.Substring(version.LastIndexOf(".") + 1));
if (buildNumber > 3000) { return CRMVersion.CRM2011UR12PLUS; }
}
catch { }
return CRMVersion.CRM2011;
}
if (version.StartsWith("6.0")) { return CRMVersion.CRM2013; }
if (version.StartsWith("6.1")) { return CRMVersion.CRM2013SP1; }
if (version.StartsWith("7")) { return CRMVersion.CRM2015; }
return CRMVersion.Unknown;
}
Hiç yorum yok:
Yorum Gönder