public void Test_CaseImport() { CrmConnection crmConnection = (CrmConnection)connection.GetConnection(); IOrganizationService service = new OrganizationService(crmConnection); string accountName1 = Guid.NewGuid().ToString(); Entity account = new Entity("account"); account.Attributes.Add("name", accountName1); Guid account1 = service.Create(account); IntegrationTool.Module.WriteToDynamicsCrm.WriteToDynamicsCrmConfiguration writeToCrmConfig = new IntegrationTool.Module.WriteToDynamicsCrm.WriteToDynamicsCrmConfiguration(); writeToCrmConfig.EntityName = "incident"; writeToCrmConfig.PrimaryKeyAttributes.Add("ticketnumber"); writeToCrmConfig.ImportMode = Module.WriteToDynamicsCrm.SDK.Enums.ImportMode.All; writeToCrmConfig.MultipleFoundMode = Module.WriteToDynamicsCrm.SDK.Enums.MultipleFoundMode.All; writeToCrmConfig.Mapping.Add(new IntegrationTool.DataMappingControl.DataMapping() { Source = "CaseID", Target = "ticketnumber" }); writeToCrmConfig.Mapping.Add(new IntegrationTool.DataMappingControl.DataMapping() { Source = "CaseTitle", Target = "title" }); writeToCrmConfig.RelationMapping.Add(new Module.WriteToDynamicsCrm.SDK.RelationMapping() { EntityName = "account", LogicalName = "customerid", Mapping = new List <DataMappingControl.DataMapping>() { new DataMappingControl.DataMapping() { Source = "CompanyName", Target = "name" } } }); writeToCrmConfig.ConfigurationId = Guid.NewGuid(); writeToCrmConfig.SelectedConnectionConfigurationId = Test_Helpers.CRMCONNECTIONID; IDatastore dataObject = DataStoreFactory.GetDatastore(); dataObject.AddColumn(new ColumnMetadata("CaseID")); dataObject.AddColumn(new ColumnMetadata("CaseTitle")); dataObject.AddColumn(new ColumnMetadata("CompanyName")); dataObject.AddData(new object[] { "CA-100", "101 Title", accountName1 }); dataObject.AddData(new object[] { "CA-101", "Anöther Title", null }); dataObject.AddData(new object[] { "CA-102", "A'Title\"chen", accountName1 }); IModule module = Activator.CreateInstance(typeof(WriteToDynamicsCrm)) as IModule; module.SetConfiguration(writeToCrmConfig); ((IDataTarget)module).WriteData(connection, new DummyDatabaseInterface(), dataObject, Test_Helpers.ReportProgressMethod); service.Delete("account", account1); }
private IDatastore GetLargerCompanyStore() { IDatastore store = GetCompanyDatastore(); store.AddData(new object[] { 3, "comp 3", 8 }); store.AddData(new object[] { 4, "comp 4", 9 }); store.AddData(new object[] { 5, "comp 5", 10 }); store.AddData(new object[] { 6, "comp 6", 11 }); return(store); }
private IDatastore GetCompanyDatastore() { IDatastore store = DataStoreFactory.GetDatastore(); store.AddColumn(new ColumnMetadata("CompanyId")); store.AddColumn(new ColumnMetadata("CompanyName")); store.AddColumn(new ColumnMetadata("ContactPerson")); store.AddData(new object [] { 1, "comp 1", 2 }); store.AddData(new object[] { 2, "comp 2", 3 }); return(store); }
public IDatastore GetDatastoreB() { IDatastore store = DataStoreFactory.GetDatastore(); store.AddColumn(new ColumnMetadata("TableBColA")); store.AddColumn(new ColumnMetadata("TableBColB")); store.AddColumn(new ColumnMetadata("TableBFull")); store.AddData(new object[] { "A", "B", "A_B" }); store.AddData(new object[] { "A", null, "A_Null" }); store.AddData(new object[] { "A", "B", "A_B_2" }); return(store); }
private IDatastore GetContactsDatastore() { IDatastore dataObject = DataStoreFactory.GetDatastore(); dataObject.AddColumn(new ColumnMetadata("FirstName")); dataObject.AddColumn(new ColumnMetadata("LastName")); dataObject.AddColumn(new ColumnMetadata("City")); dataObject.AddColumn(new ColumnMetadata("ID")); dataObject.AddData(new object[] { "Peter", "Widmer", "Wettingen", 1001 }); dataObject.AddData(new object[] { "Joachim", "Suter", "Dättwil", 1002 }); return(dataObject); }
private IDatastore GetPersonDatastore() { IDatastore store = DataStoreFactory.GetDatastore(); store.AddColumn(new ColumnMetadata("PersonId")); store.AddColumn(new ColumnMetadata("Firstname")); store.AddColumn(new ColumnMetadata("Lastname")); store.AddData(new object[] { 1, "Simon", "Miller" }); store.AddData(new object[] { 2, "Frank", "Houston" }); store.AddData(new object[] { 3, "Jill", "Smith" }); store.AddData(new object[] { 4, "Gregory", "Thomson" }); return(store); }
private void AddJoinedRowsToDatastore(IDatastore resultDatastore, List <object[]> joinedRows) { foreach (var joinedRow in joinedRows) { resultDatastore.AddData(joinedRow); } }
public void Test_AccountDeletion() { var organizationService = connection.GetConnection() as IOrganizationService; // Create dummy account, which shall be deleted string accountName1 = Guid.NewGuid().ToString(); Entity account = new Entity("account"); account.Attributes.Add("name", accountName1); Guid account1 = organizationService.Create(account); DeleteInDynamicsCrmConfiguration deleteInCrmConfig = new DeleteInDynamicsCrmConfiguration(); deleteInCrmConfig.EntityName = "account"; deleteInCrmConfig.MultipleFoundMode = DeleteInCrmMultipleFoundMode.DeleteAll; deleteInCrmConfig.DeleteMapping.Add(new DataMapping() { Source = "CompanyName", Target = "name" }); IDatastore dataObject = DataStoreFactory.GetDatastore(); dataObject.AddColumn(new ColumnMetadata("CompanyName")); dataObject.AddData(new object[] { accountName1 }); IModule module = Activator.CreateInstance(typeof(DeleteInDynamicsCrm)) as IModule; module.SetConfiguration(deleteInCrmConfig); ((IDataTarget)module).WriteData(connection, new DummyDatabaseInterface(), dataObject, ReportProgressMethod); }
public void LoadData(IConnection connection, IDatastore datastore, ReportProgressMethod reportProgress) { ExcelConnectionObject excelConnection = (ExcelConnectionObject)connection.GetConnection(); ExcelWorksheet worksheet = excelConnection.Worksheet; for (int rowNumber = 1; rowNumber <= worksheet.Dimension.End.Row; rowNumber++) { // If first row, the build MetaData if (rowNumber == 1) { for (int columnNumber = 1; columnNumber <= worksheet.Dimension.End.Column; columnNumber++) { string columnName = worksheet.GetValue(rowNumber, columnNumber).ToString(); datastore.AddColumn(new ColumnMetadata(columnName)); } continue; } // All other rows go to the data object [] rowData = new object [worksheet.Dimension.End.Column]; for (int columnNumber = 1; columnNumber <= worksheet.Dimension.End.Column; columnNumber++) { rowData[columnNumber - 1] = worksheet.GetValue(rowNumber, columnNumber); } datastore.AddData(rowData); if (StatusHelper.MustShowProgress(rowNumber - 1, worksheet.Dimension.End.Row) == true) { reportProgress(new SimpleProgressReport("Loaded " + rowNumber + " of " + worksheet.Dimension.End.Row + " records")); } } }
public void Test_RelateProductsWithCampaigns() { var defaultUnits = Test_Helpers.GetDefaultUnitGroup(organizationService); Entity campaign = new Entity("campaign"); campaign.Attributes.Add("name", "test prd_cmpgn 1"); Guid campaignId = organizationService.Create(campaign); Entity product = new Entity("product"); product.Attributes.Add("name", "test prd_cmpgn 1"); product.Attributes.Add("productnumber", "prd_cmpgn 1"); product.Attributes.Add("defaultuomscheduleid", new EntityReference("uomschedule", defaultUnits.DefaultUnitGroupId)); product.Attributes.Add("defaultuomid", new EntityReference("uom", defaultUnits.PrimaryUnitId)); product.Attributes.Add("quantitydecimal", 2); Guid productId = organizationService.Create(product); Microsoft.Crm.Sdk.Messages.PublishProductHierarchyRequest publishProduct = new Microsoft.Crm.Sdk.Messages.PublishProductHierarchyRequest(); publishProduct.Target = new EntityReference("product", productId); organizationService.Execute(publishProduct); WriteToDynamicsCrmN2NConfiguration writeToDynamicsCrmN2NConfig = new WriteToDynamicsCrmN2NConfiguration(); writeToDynamicsCrmN2NConfig.MultipleFoundMode = N2NMultipleFoundMode.None; writeToDynamicsCrmN2NConfig.Entity1Name = "campaign"; writeToDynamicsCrmN2NConfig.Entity1Mapping = new List <DataMapping>() { new DataMapping("CampaigName", "name") }; writeToDynamicsCrmN2NConfig.Entity2Name = "product;campaignproduct_association"; writeToDynamicsCrmN2NConfig.Entity2Mapping = new List <DataMapping>() { new DataMapping("ProductNumber", "productnumber") }; writeToDynamicsCrmN2NConfig.ConfigurationId = Guid.NewGuid(); writeToDynamicsCrmN2NConfig.SelectedConnectionConfigurationId = Test_Helpers.CRMCONNECTIONID; IDatastore dataObject = DataStoreFactory.GetDatastore(); dataObject.AddColumn(new ColumnMetadata("CampaigName")); dataObject.AddColumn(new ColumnMetadata("ProductNumber")); dataObject.AddData(new object[] { "test prd_cmpgn 1", "prd_cmpgn 1" }); IModule module = Activator.CreateInstance(typeof(WriteToDynamicsCrmN2N)) as IModule; module.SetConfiguration(writeToDynamicsCrmN2NConfig); ((IDataTarget)module).WriteData(connection, new DummyDatabaseInterface(), dataObject, Test_Helpers.ReportProgressMethod); organizationService.Delete("campaign", campaignId); organizationService.Delete("product", productId); }
private static void CopyDatastoreRows(IDatastore source, IDatastore target) { object[] rowCopy; for (int i = 0; i < source.Count; i++) { rowCopy = new object[source.Metadata.Columns.Count]; for (int column = 0; column < source.Metadata.Columns.Count; column++) { rowCopy[column] = source[i][column]; } target.AddData(rowCopy); } }
private IDatastore GetContactDataStore(string accountName1) { IDatastore dataObject = DataStoreFactory.GetDatastore(); dataObject.AddColumn(new ColumnMetadata("FirstName")); dataObject.AddColumn(new ColumnMetadata("LastName")); dataObject.AddColumn(new ColumnMetadata("City")); dataObject.AddColumn(new ColumnMetadata("ID")); dataObject.AddColumn(new ColumnMetadata("CompanyName")); dataObject.AddColumn(new ColumnMetadata("Status")); dataObject.AddColumn(new ColumnMetadata("Birthdate")); dataObject.AddColumn(new ColumnMetadata("OwnerFirstname")); dataObject.AddColumn(new ColumnMetadata("OwnerLastname")); dataObject.AddData(new object[] { "Peter", "Widmer", "Wettingen", 1001, accountName1, "Active", new DateTime(1980, 06, 23), "James", "Test" }); dataObject.AddData(new object[] { "Joachim 2", "Suter", "Dättwil", 1002, accountName1, "Inactive", new DateTime(2004, 12, 03), "John", "test" }); dataObject.AddData(new object[] { "James", "Brown", "London", 1003, null, "Active", null, null, null }); // Doublekey to test it works too dataObject.AddData(new object[] { "Peter", "Widmer", "Wettingen", 1001, accountName1, "Active", new DateTime(1980, 06, 23), "James", "Test" }); dataObject.AddData(new object[] { "Empty", "City", "", 1004, null, "Active", null, null, null }); return(dataObject); }
public void Test_ContactImport() { var accountName1 = Guid.NewGuid().ToString(); var account = new Entity("account"); account.Attributes.Add("name", accountName1); Guid account1 = organizationService.Create(account); // FIRST RUN var writeToCrmConfig = GetContactImportConfiguration(); IDatastore contactDatastore = GetContactDataStore(accountName1); IModule module = Activator.CreateInstance(typeof(WriteToDynamicsCrm)) as IModule; module.SetConfiguration(writeToCrmConfig); ((IDataTarget)module).WriteData(connection, new DummyDatabaseInterface(), contactDatastore, Test_Helpers.ReportProgressMethod); var contactsId1001 = Crm2013Wrapper.RetrieveMultiple(organizationService, "contact", new ColumnSet(true), new ConditionExpression("new_id", ConditionOperator.Equal, "1001")); Assert.AreEqual(1, contactsId1001.Count); var contact1001 = contactsId1001.First(); Assert.AreEqual("James Test", ((EntityReference)contact1001["ownerid"]).Name); // SECOND RUN writeToCrmConfig.ImportMode = ImportMode.AllChangedValuesOnly; writeToCrmConfig.SetOwnerMode = ImportMode.AllChangedValuesOnly; contactDatastore.SetValue(0, 2, "Baden"); contactDatastore.SetValue(0, 7, "John"); contactDatastore.SetValue(0, 8, "test"); contactDatastore.SetValue(3, 7, "John"); contactDatastore.SetValue(3, 8, "test"); contactDatastore.AddData(new object[] { "Thomas", "Meyer", "New York", 1004, accountName1, "Active", new DateTime(1973, 04, 24), "James", "Test" }); ((IDataTarget)module).WriteData(connection, new DummyDatabaseInterface(), contactDatastore, Test_Helpers.ReportProgressMethod); var contactsId1004 = Crm2013Wrapper.RetrieveMultiple(organizationService, "contact", new ColumnSet(true), new ConditionExpression("new_id", ConditionOperator.Equal, "1004")); Assert.AreEqual(1, contactsId1004.Count); contactsId1001 = Crm2013Wrapper.RetrieveMultiple(organizationService, "contact", new ColumnSet(true), new ConditionExpression("new_id", ConditionOperator.Equal, "1001")); Assert.AreEqual(1, contactsId1001.Count); contact1001 = contactsId1001.First(); Assert.AreEqual("John test", ((EntityReference)contact1001["ownerid"]).Name); organizationService.Delete("account", account1); }
public void LoadData(IConnection connection, IDatastore datastore, ReportProgressMethod reportProgress) { var clientContext = connection.GetConnection() as ClientContext; var oList = clientContext.Web.Lists.GetByTitle(this.Configuration.ListName); var camlQuery = new CamlQuery() { ViewXml = this.Configuration.CamlQueryViewXml }; var collListItem = oList.GetItems(camlQuery); clientContext.Load(collListItem); clientContext.ExecuteQuery(); foreach (ListItem listItem in collListItem) { foreach (var fieldValue in listItem.FieldValues) { ExtractTableHeaders(datastore, fieldValue); } object[] data = new object[datastore.Metadata.Columns.Count]; foreach (var fieldValue in listItem.FieldValues) { if (fieldValue.Value as FieldUserValue != null) { var fieldUserValue = (FieldUserValue)fieldValue.Value; data[datastore.Metadata[fieldValue.Key + "_LookupId"].ColumnIndex] = fieldUserValue.LookupId; data[datastore.Metadata[fieldValue.Key + "_LookupValue"].ColumnIndex] = fieldUserValue.LookupValue; } else if (fieldValue.Value as FieldLookupValue != null) { var fieldLookupValue = (FieldLookupValue)fieldValue.Value; data[datastore.Metadata[fieldValue.Key + "_LookupId"].ColumnIndex] = fieldLookupValue.LookupId; data[datastore.Metadata[fieldValue.Key + "_LookupValue"].ColumnIndex] = fieldLookupValue.LookupValue; } else { data[datastore.Metadata[fieldValue.Key].ColumnIndex] = fieldValue.Value; } } datastore.AddData(data); } }
public void LoadData(IConnection connection, IDatastore datastore, ReportProgressMethod reportProgress) { var databaseConnection = connection.GetConnection() as SQLiteConnection; if (databaseConnection.State != System.Data.ConnectionState.Open) { databaseConnection.Open(); } var databaseCommand = new SQLiteCommand(Configuration.SqlValue, databaseConnection); var databaseReader = databaseCommand.ExecuteReader(); int counter = 0; while (databaseReader.Read()) { // Read the metadata from the source if (datastore.Count == 0) { for (int i = 0; i < databaseReader.FieldCount; i++) { datastore.AddColumn(new ColumnMetadata(databaseReader.GetName(i))); } } // Add data to the datastore object[] data = new object[databaseReader.FieldCount]; for (int dataIndex = 0; dataIndex < databaseReader.FieldCount; dataIndex++) { data[dataIndex] = databaseReader.GetValue(dataIndex); } datastore.AddData(data); if (StatusHelper.MustShowProgress(counter, -1) == true) { reportProgress(new SimpleProgressReport("Loaded " + (counter + 1) + " records")); } counter++; } databaseConnection.Dispose(); }
public void LoadData(IConnection connection, IDatastore datastore, ReportProgressMethod reportProgress) { using (SqlConnection sqlConnection = connection.GetConnection() as SqlConnection) { sqlConnection.Open(); using (SqlCommand sqlCommand = new SqlCommand(Configuration.SqlValue, sqlConnection)) { using (SqlDataReader reader = sqlCommand.ExecuteReader()) { int counter = 0; while (reader.Read()) { // Read the metadata from the source if (datastore.Count == 0) { for (int i = 0; i < reader.FieldCount; i++) { datastore.AddColumn(new ColumnMetadata(reader.GetName(i))); } } // Add data to the datastore object[] data = new object[reader.FieldCount]; for (int dataIndex = 0; dataIndex < reader.FieldCount; dataIndex++) { data[dataIndex] = reader.GetValue(dataIndex); } datastore.AddData(data); if (StatusHelper.MustShowProgress(counter, -1) == true) { reportProgress(new SimpleProgressReport("Loaded " + (counter + 1) + " records")); } counter++; } } } } }
public void Test_RelateContactsWithInvoice() { Entity contact = Test_Helpers.CreateDummyContact(); Guid contactId = organizationService.Create(contact); Entity invoice = Test_Helpers.CreateDummyInvoice(); Guid invoiceId = organizationService.Create(invoice); WriteToDynamicsCrmN2NConfiguration writeToDynamicsCrmN2NConfig = new WriteToDynamicsCrmN2NConfiguration(); writeToDynamicsCrmN2NConfig.MultipleFoundMode = N2NMultipleFoundMode.None; writeToDynamicsCrmN2NConfig.Entity1Name = "contact"; writeToDynamicsCrmN2NConfig.Entity1Mapping = new List <DataMapping>() { new DataMapping("FirstName", "firstname") }; writeToDynamicsCrmN2NConfig.Entity2Name = "invoice;contactinvoices_association"; writeToDynamicsCrmN2NConfig.Entity2Mapping = new List <DataMapping>() { new DataMapping("InvoiceNo", "invoicenumber") }; writeToDynamicsCrmN2NConfig.ConfigurationId = Guid.NewGuid(); writeToDynamicsCrmN2NConfig.SelectedConnectionConfigurationId = Test_Helpers.CRMCONNECTIONID; IDatastore dataObject = DataStoreFactory.GetDatastore(); dataObject.AddColumn(new ColumnMetadata("FirstName")); dataObject.AddColumn(new ColumnMetadata("InvoiceNo")); dataObject.AddData(new object[] { contact["firstname"], invoice["invoicenumber"] }); IModule module = Activator.CreateInstance(typeof(WriteToDynamicsCrmN2N)) as IModule; module.SetConfiguration(writeToDynamicsCrmN2NConfig); ((IDataTarget)module).WriteData(connection, new DummyDatabaseInterface(), dataObject, Test_Helpers.ReportProgressMethod); organizationService.Delete("contact", contactId); organizationService.Delete("invoice", invoiceId); }
public static void AddDatarowToDatastore(IDatastore datastore, TransformationLog transformationLog, int sourceRowIndex, XElement row) { datastore.AddData(new object[datastore.Metadata.Columns.Count]); // Copy values from sourcerow to new row for (int i = 0; i < datastore[sourceRowIndex].Length; i++) { datastore[datastore.Count - 1][i] = datastore[sourceRowIndex][i]; } // Add new columns if necessary and fill the values foreach (var column in row.Elements()) { if (datastore.Metadata.Columns.ContainsKey(column.Name.LocalName) == false) { transformationLog.NewColumns.Add(column.Name.LocalName); datastore.AddColumn(new ColumnMetadata(column.Name.LocalName)); } datastore.SetValue(datastore.Count - 1, datastore.Metadata[column.Name.LocalName].ColumnIndex, column.Value); } }
private void FetchXmlEntityCollectionRetrieved(EntityCollection retrievedEntityCollection) { foreach (Entity entity in retrievedEntityCollection.Entities) { foreach (var attribute in entity.Attributes) { if (datastore.Metadata.ContainsColumn(attribute.Key) == false) { datastore.AddColumn(new ColumnMetadata(attribute.Key)); } } object[] data = new object[datastore.Metadata.Columns.Count]; foreach (var attribute in entity.Attributes) { if (attribute.Value as AliasedValue != null) { data[datastore.Metadata[attribute.Key].ColumnIndex] = ((AliasedValue)attribute.Value).Value; } else if (attribute.Value as EntityReference != null) { data[datastore.Metadata[attribute.Key].ColumnIndex] = ((EntityReference)attribute.Value).Id; } else if (attribute.Value as OptionSetValue != null) { data[datastore.Metadata[attribute.Key].ColumnIndex] = ((OptionSetValue)attribute.Value).Value; } else if (attribute.Value as Money != null) { data[datastore.Metadata[attribute.Key].ColumnIndex] = ((Money)attribute.Value).Value; } else { data[datastore.Metadata[attribute.Key].ColumnIndex] = attribute.Value; } } datastore.AddData(data); } }
public void Test_ContactImport() { CrmConnection crmConnection = (CrmConnection)connection.GetConnection(); IOrganizationService service = new OrganizationService(crmConnection); string accountName1 = Guid.NewGuid().ToString(); Entity account = new Entity("account"); account.Attributes.Add("name", accountName1); Guid account1 = service.Create(account); IntegrationTool.Module.WriteToDynamicsCrm.WriteToDynamicsCrmConfiguration writeToCrmConfig = new IntegrationTool.Module.WriteToDynamicsCrm.WriteToDynamicsCrmConfiguration(); writeToCrmConfig.EntityName = "contact"; writeToCrmConfig.PrimaryKeyAttributes.Add("new_id"); writeToCrmConfig.ImportMode = Module.WriteToDynamicsCrm.SDK.Enums.ImportMode.All; writeToCrmConfig.MultipleFoundMode = Module.WriteToDynamicsCrm.SDK.Enums.MultipleFoundMode.All; writeToCrmConfig.Mapping.Add(new IntegrationTool.DataMappingControl.DataMapping() { Source = "ID", Target = "new_id" }); writeToCrmConfig.Mapping.Add(new IntegrationTool.DataMappingControl.DataMapping() { Source = "FirstName", Target = "firstname" }); writeToCrmConfig.Mapping.Add(new IntegrationTool.DataMappingControl.DataMapping() { Source = "LastName", Target = "lastname" }); writeToCrmConfig.Mapping.Add(new IntegrationTool.DataMappingControl.DataMapping() { Source = "Status", Target = "statuscode" }); writeToCrmConfig.Mapping.Add(new IntegrationTool.DataMappingControl.DataMapping() { Source = "Birthdate", Target = "birthdate" }); writeToCrmConfig.RelationMapping.Add(new Module.WriteToDynamicsCrm.SDK.RelationMapping() { EntityName = "account", LogicalName = "parentcustomerid", Mapping = new List <DataMappingControl.DataMapping>() { new DataMappingControl.DataMapping() { Source = "CompanyName", Target = "name" } } }); writeToCrmConfig.ConfigurationId = Guid.NewGuid(); writeToCrmConfig.SelectedConnectionConfigurationId = Test_Helpers.CRMCONNECTIONID; writeToCrmConfig.PicklistMapping.Add(new Module.WriteToDynamicsCrm.SDK.PicklistMapping() { LogicalName = "statuscode", MappingType = Module.WriteToDynamicsCrm.SDK.Enums.PicklistMappingType.Manual, Mapping = new List <DataMappingControl.DataMapping>() { new DataMappingControl.DataMapping() { Source = "Active", Target = "1" }, new DataMappingControl.DataMapping() { Source = "Inactive", Target = "2" } } }); IDatastore dataObject = DataStoreFactory.GetDatastore(); dataObject.AddColumn(new ColumnMetadata("FirstName")); dataObject.AddColumn(new ColumnMetadata("LastName")); dataObject.AddColumn(new ColumnMetadata("City")); dataObject.AddColumn(new ColumnMetadata("ID")); dataObject.AddColumn(new ColumnMetadata("CompanyName")); dataObject.AddColumn(new ColumnMetadata("Status")); dataObject.AddColumn(new ColumnMetadata("Birthdate")); dataObject.AddData(new object[] { "Peter", "Widmer", "Wettingen", 1001, accountName1, "Active", new DateTime(1980, 06, 23) }); dataObject.AddData(new object[] { "Joachim 2", "Suter", "Dättwil", 1002, accountName1, "Inactive", new DateTime(2004, 12, 03) }); dataObject.AddData(new object[] { "James", "Brown", "London", 1003, null, "Active", null }); // Doublekey to test it works too dataObject.AddData(new object[] { "Peter", "Widmer", "Wettingen", 1001, accountName1, "Active", new DateTime(1980, 06, 23) }); IModule module = Activator.CreateInstance(typeof(WriteToDynamicsCrm)) as IModule; module.SetConfiguration(writeToCrmConfig); ((IDataTarget)module).WriteData(connection, new DummyDatabaseInterface(), dataObject, Test_Helpers.ReportProgressMethod); service.Delete("account", account1); }