I'm a C# developer and have been tasked with purging records from the Attachment entity for a GDPR requirement.
However when I invoke the 'Delete' method on the Xrm Sdk toolkit (Microsoft.Xrm.Sdk.IOrganizationService.Delete) the following exception is raised - "The 'Delete' method does not support entities of type 'attachment'." - ErrorCode: 0x80040800.
The Delete method works fine against the ActivityMimeAttachment entity and a number of other entities so question is how are you meant to delete Attachment entity records?
Apologies if I'm posting in the wrong place but I couldn't see a developer forum on the list...
Thanks Erhan and David,
I've tested this and deleting from the ActivityMimeAttachment entity does indeed delete from the Attachment entity.
Worth noting that ActivityMimeAttachmentId and AttachmentId are two different Guids! So you need to make a note of the AttachmentId before deleting the ActivityMimeAttachment record or you won't be able to do a check...
Yes, do it. Just make document related fields Null, "IsDocument" field included.
However, after doing it check in the "Attachment" table if the attachment is deleted from the table.
In addition to 'Filename' and 'MimeType' fields, setting 'FileSize' to zero and 'IsDocument' to No, you should also set the documentbody to null (this field stores the file contents)
Thanks Erhan,
Figured that was probably the case.
Any thoughts on removing attachments from Notes whilst retaining the Notes record?
We were thinking of blanking the 'Filename' and 'MimeType' fields, setting 'FileSize' to zero and 'IsDocument' to No.
Regards,
Hi,
I assume you are either/both talking about purging annotation (Notes) and activitymimeattachment (Attachments) entities. Attachment is not an entity, it is a table in the database. So, activitymimeattachment and attachment tables work together to store the Attachments.
If you need to delete Attachments, then pass the activitymimeattachment entity to the Delete method.
If you need to delete Notes, then pass the annotation entity to the Delete method.
Regards,
Hi Rita,
Thanks for the reply. So I guess my next question is how are we meant to conform to GDPR legislation if we can't delete from the Attachment entity? We have a legal requirement to delete customer data after a certain period of time.
Is it possible that data in this entity is deleted as part of a cascading delete? I notice there is a relationship between Attachment and ActivityMimeAttachment ie:
docs.microsoft.com/.../attachment
Does deleting from ActivityMimeAttachment cause a delete to Attachment?
Thanks.
Hi ,
Im afraid Attachment entity does not support Delete request as it is not listed in the supported entities docs.microsoft.com/.../microsoft.xrm.sdk.messages.deleterequest.
As an alternative you have the options listed in here docs.microsoft.com/.../microsoft.xrm.sdk.messages.deleterequest
Thanks
Hello,
Try "annotation".
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156