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 :
Small and medium business | Business Central, N...
Suggested Answer

Clean Tenant Media

(2) ShareShare
ReportReport
Posted on by 31
Hi guys,

I need help, I have a storage problem in my central Business Central environment.



Analyzing the stored data, I have seen that we have the “Tenant Media” table oversized and I want to empty it completely.

 
 
 
I have tried using data administration and searching for orphaned files, but it does not find any more orphaned files.
 
 
 
 
I have also tried to delete the data by code, inserting a button in a page and it works but for a few days, after a few days Microsoft blocks this action and recovers the deleted data.
 
 
 
 
I need your help, thank you very much
 
Regards
Vicente
I have the same question (0)
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,150 Super User 2025 Season 2 on at

    1. Use the Detached Media Cleanup Page

     
    • Navigate to Data Administration in Business Central.

    • Select More Options if needed.

    • Go to Actions > Data Cleanup > Miscellaneous > Delete Detached Media.

    • If you want to delete media without reviewing, select Actions > Schedule Cleanup Task and confirm deletion.


    •  
     

    2. Use the Media Cleanup Codeunit

     
    • Business Central provides a Media Cleanup Codeunit that helps remove orphaned media entries.

    • You can use the GetDetachedTenantMedia method to identify detached media.

    • The GetTenantMediaFromDetachedMediaSet method can also help remove media linked to detached sets.


    •  
     

    3. Delete Orphaned Media Using Built-in Methods

     
    • If you're using Business Central 2023 Wave 1 (BC22) or later, Microsoft introduced:
      • Media.FindOrphans() – Finds orphaned media.

      • MediaSet.FindOrphans() – Finds orphaned media sets.


      •  

    • You can use these methods to identify and delete unused media files


    •  
     
     
    Mark below checkbox to make this answer Verified if it helps you.
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,150 Super User 2025 Season 2 on at
    you may want to consider implementing some sort of retention policy for the Tenant Media table, such as regularly purging old or unused records. This can help to keep the size of the table under control and prevent it from consuming excessive disk space. However, be sure to carefully consider any potential impact on your business processes before implementing such a policy.
  • Vicente Pastor Profile Picture
    31 on at
    Hi Sohail,

    Thank you very much for your quick response.

     
    But the problem is that the files in the table "Tenant Media" are NOT orphaned. Then when I click on delete orphaned data it does not delete anything.
     
    I still have the same problem after following your instructions.
     
     
     
    Regards
    Vicente
  • Vicente Pastor Profile Picture
    31 on at
    I need to empty this table completely, I don't care if I lose the content.
  • Suggested answer
    RockwithNav Profile Picture
    8,637 Super User 2025 Season 2 on at
    Retention policy is a very nice feature which you can implement moving forward to auto clean the data.
    Currently Data Administration and then deletion is the best standard approach. Did you try executing this?
     
  • Vicente Pastor Profile Picture
    31 on at
    Yes Rock, i try... but in the retention policies I cannot directly configure the table “Tenant Media”.
     
  • Suggested answer
    YUN ZHU Profile Picture
    95,729 Super User 2025 Season 2 on at
    1.4TB over? Because your Tenant Media is in use, if you clear it, it will affect the data.
    If the company needs to manage a lot of attachments, it is recommended to use an external solution, such as the following.
    Dynamics 365 Business Central: Manage attachments in SharePoint (Save attachments externally and do not use BC capacity)
     
    Hope this helps.
    Thanks.
    ZHU
  • Vicente Pastor Profile Picture
    31 on at
    Hi Zhu,

    Yeah, I know, that's why they now work with sharepoint. The problem is that this has been done years ago and I need to free up space, can you think of what to do?
     
    Regards
    Vicente
  • Peter76 Profile Picture
    2 on at
    Hi Vincente,
     
    I think you have to clear the media fields which point to the tenant media.
     
    For instance:
    Look at table 1173 Document Attachments
     
    Clear the "Document Reference ID"
  • Gerardo Rentería García Profile Picture
    25,236 Most Valuable Professional on at

    Hi, good day
    I hope this can help you, and give you some hints.

    Solved: Tenant Media

    Solved: Tenant Media table id: 2000000184 growing exponentially

    Best Regards
    Gerardo

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans