ImportContactsToAddressBookWithMergeOption

Bulk creates, or bulk updates, contacts in an address book with merge option

This operation bulk creates, or bulk updates, contacts with merge options.

Import format can either be CSV or Excel. It must contain one column with the heading 'Email'. Passing a valid 'mergeOption' parameter is compulsory. Any other columns will attempt to map to your custom data fields. The ID of returned object can be used to query import progress.

For merge options, you can update all data fields by entering 'Overwrite', avoid updating data fields that contain blank values by entering 'OnlyOverwriteIfNotEmpty', or you can choose not to update data fields that contain values by entering 'OnlyOverwriteIfContactDataNotPopulated'.

This method mimics the existing bulk create contacts in address book method, but with an additional parameter, 'mergeOption', that allows you to specify how the import should handle empty fields, which is similar to the functionality described in this article.

SOAP action: http://apiconnector.com/v2/ApiService/ImportContactsToAddressBookWithMergeOption

📘

Input and output parameters

Input parameters

  • AddressBook ID - required; integer
  • Data - required; file
  • dataType - required; string
  • mergeOption - required; ApiContactMergeOptionTypes - enum ('NotAvailableInThisVersion', 'Overwrite', 'OnlyOverwriteIfNotEmpty', 'OnlyOverwriteIfContactDataNotPopulated')

Output parameters

  • Id - GUID
  • Status - string ('Finished', 'NotFinished', 'RejectedByWatchdog', 'InvalidFileFormat', 'ExceedsAllowedContactLimit', 'Unknown', 'Failed')

Example

using (var client = new ApiServiceClient())
{
  client.ClientCredentials.UserName.UserName = "username";
  client.ClientCredentials.UserName.Password = "password";

  var path = @"contacts.csv";
  var data = File.ReadAllBytes(path);
  var dataType = "csv";
  var addressBookId = 1;
  var mergeOption = ApiContactMergeOptionTypes.OnlyOverwriteIfNotEmpty;
  var contactImport = client.ImportContactsToAddressBookWithMergeOption(addressBookId, data, dataType, mergeOption);
}