How many of your labels do you maintain, and yet are not being displayed in any way to a user?

I set out to answer this question on one of my projects, and found 10%, over 100 labels, were created and abandoned as functionality was changed over time.  These labels did not provide any value, and might lead to requiring translations which would never be shown to anyone.

The following PowerShell script takes the path of a module and will check that every single label is being used.  It checks the actual code instead of relying on the cross reference database (just in case).  The return value is an array of PowerShell objects which can be saved as  CSV, or filtered to find ones which can be deleted.

https://github.com/dodiggitydag/Find-UnusedD365FOLabels

Find-UnusedD365FOLabels "C:\VC\Dag\DEV1\Main\Metadata\DagExtensions\DagExtensions" | Export-Csv -NoTypeInformation -Path "$env:USERPROFILE\Desktop\Unused Labels.csv"

Please try this on your project(s) and let me know how many unused labels you are able to delete!

Disclaimer: make sure a label is not being used in any branch before removing it from all of your branches 🙂  The F&O compiler should reject the objects which are missing labels, but don’t assume.

Example

In this example I’ve added two unused labels.

I run the command here.

Exported to CSV, it is easy to filter by used/unused and take action.