3.1 seems to only copy email attachments instead of moving them (CRM 2016 Online)

Jun 8, 2016 at 12:58 AM
I have installed 3.1 into CRM Online and it copies the email attachments across to Azure File Storage quite nicely. It seems to leave the original attachment as is though. If I remove the newly copied attachment from the file storage I can still open it from CRM (indicating that the original attachment is still intact).

Annotations seem to be working as planned - the attachment is Moved to File Storage and if I delete it from Azure, then try to open the annotation attachment from CRM I get an error message.

Jun 9, 2016 at 12:57 AM
Hi Simon,

I think I misread previously. Will take a look at what you mention.
Jun 9, 2016 at 1:01 AM
Edited Jun 9, 2016 at 1:01 AM
Thanks for that - This is for new email attachments rather than a migration. I'll be looking at how to do the equivalent of your SQL scripts with CRM Online a bit later on so I can use the 3.1 migration tool.
Jun 9, 2016 at 1:37 AM
Edited Jun 9, 2016 at 1:39 AM
See v3.1.1 just released. I never noticed that email attachments seems to require the event to be "Post-Operation". If you can let me know how you go and whether it works for you now, bit swamped atm.

P.S. You can manually update v3.1 : Replace the binary with CRM plugin tool, change the "Create of activitymimeattachment" to "Post-Operation" (I made it async).

P.P.S. If you use v3.1 with CRM online and need to migrate existing binaries, you will have the filesize issues I have discussed. As far as I'm aware, you cannot update the database directly, and if you use CRM organizationservice, filesize field will be wrong.
Marked as answer by dawidpotgieter on 6/9/2016 at 1:22 PM
Jun 9, 2016 at 2:20 AM
Thanks for your help. Setting the step to Post-Operation and Async has fixed the issue.

One last question - can I use the 3.0 Migrate tool to "Move" existing binaries to CRM Online but have the 3.1 code/steps installed?

Thanks again for a fantastic utility!
Jun 9, 2016 at 3:27 AM
Edited Jun 9, 2016 at 8:22 PM
One last question - can I use the 3.0 Migrate tool to "Move" existing binaries to CRM Online but have the 3.1 code/steps installed?
EDIT : The answer is actually NO. 3.0 and 3.1 works differently because 3.0 needs another crm entity to work.

I'd recommend using v3.1 migration tool (I haven't fully tested v3.0), and modify the following method :

MigrateEntityToExternal :

Inside this if :
if (storageProvider.Create(entity.Id, fileName, Convert.FromBase64String((string)entity.Attributes[documentBodyKey])))
add the following 2 lines :
entity.Attributes[GenericConstants.Constants[entity.LogicalName][GenericConstants.DocumentBodyAttributeKey]] = GenericConstants.EmptyBodyContent;
This will remove the binary data after it's been copied external.
Keep in mind that this will mess up the filesize field on annotations, but if you're not too worried about ppl searching on that, then it's totally fine.

And thanks for the feedback. I assume from this that it works fine in CRM online?
Jun 9, 2016 at 3:39 AM
It is definitely working with with CRM Online - We are using CRM Online 2016 Update (Spring Release).
Jun 9, 2016 at 9:12 PM
I've added another version of the migration tool v3.1.2. It now automatically MOVES attachments, and gives you an option to MOVE annotation binaries instead of just copying them. Be sure to understand the impact on your data if you use the option.