web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to automatically delete image from Azure Blob Storage while deleting attachment

(0) ShareShare
ReportReport
Posted on by 668

Hi Folks,

I was trying to delete unused images from Azure Blob Storage which is coming from D365 FO as a attachment.

When a new attachment is done in D365 FO, the same image will be uploaded in blob Storage. Now I want to delete the Attachment from D365 FO through code and it should automatically delete the file from Blob storage.

but it is not working. Could you please help me on this.

please let me know if some information is required from my end.

I have the same question (0)
  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    I think that document management supports this feature, if enabled.

    I recommend debugging DocuRef.delete() - it'll give you more information than mere "it's not working".

  • D365FO Avatar Profile Picture
    668 on at

         if(isExist)
                    {
                       ttsbegin;
                    
                        if(docuref.validateDelete())
                        {
                            docuRef.delete();
                        }
                        else
                        {
                            ttsabort;
                        }                    
    
                        ttscommit;
                    } 

    pastedimage1680275304605v1.png

    Although written a class with looping for DocuRef and at last calling DocuRef.Delete().

    But still it not worked than I tried to update some Document management parameters 

    1. Enable checkbox "Deferred deletion enabled" and update 0 in "Number of days to defer deletion"

    2. Disabled checkbox "Enable Document History" 

    But still it is not working. Could you please let me know if I'm wrong somewhere.

  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    As I said, I would debug delete() method to see what's going on there. Collection information is better than guessing. By the way, I believe that enabling "Deferred deletion enabled" goes against your requirements. Again, you can see the impact of this parameter when looking into delete().

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 456 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans