Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Media Asset Usage Report

Vote:
 

We are looking to create a report of global media assets, site media assets, and content media assets with no value entered for the Description. For global assets, the report would include the path to the asset (e.g. For All Sites > Images and /globalassets/images/my-image.jpg). For site assets, the report would include the site and the path to the asset (e.g. My Site > For This Site > Images and https://www.mysite.com/siteassets/images/my-image.jpg). For content assets, the report would include the site, the path to the parent content item (i.e. how to navigate to the content item in the CMS so the media asset can be edited...My Site > My Page > My Nested Page > My Nested Page Hero Block), and the path to the asset (e.g. For This Block > Images). Does anyone know how to query the database or utilize Episerver's SDK to obtain this information?

#252191
Mar 30, 2021 19:01
Vote:
 

Depending on how you've got Episerver Search and Naivigation set up indexing wise (e.g. if it's indexing unpublished content) you could use this. Else you can get the assets content refererence using ContentReference.GlobalBlockFolder and then using the IContentLoader to get all of the ancestors (or loop through children) checking the types as you go to build up a list of all your items.

For the Site specific assets you can use SiteBlockFolder I believe after getting the sites from the site repository and do the same. You can get the paths, urls and such via the standard way for either of the IContent items either by using the UrlResolver or off properties on the items.

#252237
Edited, Mar 31, 2021 8:31
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.