Skip to content

Commit

Permalink
implemented fix for error that occurred when attempting to check CRM …
Browse files Browse the repository at this point in the history
…Online version #
  • Loading branch information
lucasalexander committed May 11, 2016
1 parent bca048d commit 765c0f7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
Expand Up @@ -50,4 +50,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.10.0.1")]
[assembly: AssemblyVersion("1.10.1.1")]
45 changes: 29 additions & 16 deletions AlexanderDevelopment.ConfigDataMover.Lib/Importer.cs
Expand Up @@ -212,25 +212,38 @@ private void ParseConnections()
//get the organization id
Guid orgId = ((WhoAmIResponse)service.Execute(new WhoAmIRequest())).OrganizationId;

//query discovery service to determine version of target organization
var discoveryService = new DiscoveryService(_targetConn);
RetrieveOrganizationsRequest orgsRequest =
new RetrieveOrganizationsRequest()
//if host is xxx.dynamics.com, then target is crm online
if (_targetConn.ServiceUri.Host.EndsWith("dynamics.com"))
{
AccessType = EndpointAccessType.Default,
Release = OrganizationRelease.Current
};
RetrieveOrganizationsResponse organizations =
(RetrieveOrganizationsResponse)discoveryService.Execute(orgsRequest);
foreach (OrganizationDetail organization in organizations.Details)
{
if(organization.OrganizationId == orgId)
//assume target version is 7.1.0.0 - crm 2015 update 1 as a minimum
_targetVersion = "7.1.0.0";

//log target version
LogMessage("INFO", "target is - CRM online");
LogMessage("INFO", "assuming target version is - " + _targetVersion);
}
else {

//query discovery service to determine version of target organization
var discoveryService = new DiscoveryService(_targetConn);
RetrieveOrganizationsRequest orgsRequest =
new RetrieveOrganizationsRequest()
{
//set target version variable for use later
_targetVersion = organization.OrganizationVersion;
AccessType = EndpointAccessType.Default,
Release = OrganizationRelease.Current
};
RetrieveOrganizationsResponse organizations =
(RetrieveOrganizationsResponse)discoveryService.Execute(orgsRequest);
foreach (OrganizationDetail organization in organizations.Details)
{
if (organization.OrganizationId == orgId)
{
//set target version variable for use later
_targetVersion = organization.OrganizationVersion;

//log target version
LogMessage("INFO", "target version is - " + organization.OrganizationVersion);
//log target version
LogMessage("INFO", "target version is - " + _targetVersion);
}
}
}
}
Expand Down
Expand Up @@ -50,4 +50,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.10.0.1")]
[assembly: AssemblyVersion("1.10.1.1")]
Expand Up @@ -50,4 +50,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.10.0.1")]
[assembly: AssemblyVersion("1.10.1.1")]

0 comments on commit 765c0f7

Please sign in to comment.