Uploading Email or Note Attachments using KingswaySoft for Dynamics 365

When migrating attachments from one organization to another using KingswaySoft it’s straightforward to use the field mapping. But when doing migrations or building integrations where you need to upload files as attachments, we would need to pass in the appropriate format for the file body of the email attachment. The same applies for the Attachment entity.

There are two ways we could accomplish this, as specified by KingswaySoft under the FAQ page.

  • Encode the file content using base64 encoding
  • Using Import Column component to read the file as an DT_IMAGE field in which case the KingswaySoft destination component will automatically handle the encoding before writing to the CRM server.

When testing #1 using a NTEXT(datatype of the column in CRM) output column from a script component, the destination component does not work and fails with the below error even when passing the file content using base64 encoding.

"The attachment body should be a valid Base 64 string."

Since this approach did not work, I ended up using the straightforward, no code approach with the Import Column component and it worked. You can find this component under ‘Other Transforms’ in your SSIS toolkit.

Here is an example of the Import Column by providing the path to the file. In my case every row that was being processed had a column FilePath associated with the record.

Do not worry about the Data Type being DT_IMAGE instead of NTEXT as shown by the component. The destination component will take care of this.

Hope this saves you time when you are trying to upload attachments when CRM is not the source.