jamesnovak / PortalRecordsMoverConsole

Port of the Portal Records Mover XrmToolbox plugin by Tanguy Touzard
GNU General Public License v3.0
12 stars 8 forks source link

Export error #8

Open rickjan130 opened 4 years ago

rickjan130 commented 4 years ago

I am getting the following error when attempting to run PortalRecordsMover console: {"Organization cannot be null or empty.\r\nParameter name: Organization Name"}

Here's the stack trace: at Microsoft.Xrm.Tooling.Connector.CrmServiceClient.ConnectToCrmWebService(String crmConnectionString) in C:\Users\rputnam\AppData\Local\JetBrains\Shared\vAny\DecompilerCache\decompiler\241CFB4C-CA37-4CC4-9DB9-003C3A7E938A\b7\8ac959f9\CrmServiceClient.cs:line 302 at Microsoft.Xrm.Tooling.Connector.CrmServiceClient..ctor(String crmConnectionString) in C:\Users\rputnam\AppData\Local\JetBrains\Shared\vAny\DecompilerCache\decompiler\241CFB4C-CA37-4CC4-9DB9-003C3A7E938A\b7\8ac959f9\CrmServiceClient.cs:line 292 at PortalRecordsMover.AppCode.Exporter..ctor(ExportSettings settings) in C:\Users\rputnam\source\rputnam\PortalRecordsMoverConsole\AppCode\Exporter.cs:line 26 at PortalRecordsMover.PortalMover.Main(String[] args) in C:\Users\rputnam\source\rputnam\PortalRecordsMoverConsole\Program.cs:line 31

The exception is thrown at line 302 of CrmServiceClient.cs in the Microsoft.Xrm.Tooling.Connector. The only place I can see where the organization can be set is in the Utilities.cs class of the Microsoft.Xrm.Tooling.Connector. On line 69 the if statement doesn't match my serviceUri.Host of ****.microsoftdynamics.us.

My redacted settings file is:

{ "ActiveItemsOnly": true, "CreateFilter": "2020-09-30T12:00:00", "ModifyFilter": "2019-09-30T12:00:00",

"PriorDaysToRetrieve": "8",

/ Enum values, either number or name will work: CreateOnly=1, ModifyOnly, CreateAndModify / "DateFilterOptions": "ModifyOnly", "WebsiteFilter": "**",

/ you can specify a date format mask here and the current date time will be added. Use same value to export from the Source environment and immediately import into the Target / "ExportFilename": "portal export {0:yyyy-MM-dd}.xml", "ImportFilename": "portal export {0:yyyy-MM-dd}.xml",

"SourceEnvironment": "https://*****.crm.microsoftdynamics.us", "SourceUsername": "***", "SourcePassword": "*",

"TargetEnvironment": "https://*****.crm.microsoftdynamics.us", "TargetUsername": "***", "TargetPassword": "*", "WebsiteIdMapping": [ { "SourceId": "**", "TargetId": "**" } ], / Deactivate plugins before import, reactivate on completion / "DeactivateWebPagePlugins": true,

/ Remove JS restriction in system settings / "RemoveJavaScriptFileRestriction": true, / Clean target organization annotation for web file so that only the annotation you import is kept in the web file / "CleanWebFiles": true, / List of adx_ entity schema names that should be moved. if empty, all will be moved / "SelectedEntities": [] }

rickjan130 commented 4 years ago

In the Microsoft.Xrm.Tooling.Connector/Utilities.cs class line 69, is the following: if (serviceUri.Host.ToUpperInvariant().Contains("DYNAMICS.COM") || serviceUri.Host.ToUpperInvariant().Contains("MICROSOFTDYNAMICS.DE") || serviceUri.Host.ToUpperInvariant().Contains("DYNAMICS-INT.COM"))

My serviceUri is xxxxx.crm.microsoftdynamics.us so it won't match on any of the 3 criteria. Are GCC High tenants supported by the Portal Records Mover Console?

rickjan130 commented 4 years ago

I solved my issue by updating the Microsoft.CrmSdk.XrmTooling.CoreAssembly nuget pkg from 9.0.0.7 to 9.1.0.51. The program is now working as expected.