ConfigMgr – How to find the Application Name for a ContentID

While reviewing ConfigMgr status messages for clients reporting problems acquiring package content (Message ID 10025) I found some code snippets on that maps the ContentID to the name of the application. As i had to do several lookups, I decided to create a function for it.