Mailbox retention tag application and management are one of the more complex administrative tasks on Exchange from 2010 and one task scripting can be a great help with.
With EWS there are two ways you can deal with retrieving the Retention Tags that have been applied to a Folder or Item. In 2013 and 2016, EWS returns the retention tags applied to a folder or Item as a Strongly typed property which makes things easier to deal with. In Exchange 2010 you need to access the underlying extended properties for Retention tags (this will also work on 2013 and 2016 because the extended properties are the same).
I've posted up a script module on GitHub here https://github.com/gscales/Powershell-Scripts/blob/master/ReportTagged.ps1 that can do this using the Extended properties so it will work on Exchange 2010 and up.
Report-TaggedFolders - Creates a Report of the FolderTag applied to each of the Folders in a Mailbox (if they are tagged). To get all the availbile Personal Tags the Exchange Management Shell Get-RetentionPolicyTag cmdlet is used. The script also then uses the Tag retrieved from the folder to report then number of Items in that folder that have that Tag applied and produces a report like
Report-UntaggedFolder - Creates a Report of the Untagged Folder in a Mailbox with the FolderClass, ItemCount and ItemSize.
With EWS there are two ways you can deal with retrieving the Retention Tags that have been applied to a Folder or Item. In 2013 and 2016, EWS returns the retention tags applied to a folder or Item as a Strongly typed property which makes things easier to deal with. In Exchange 2010 you need to access the underlying extended properties for Retention tags (this will also work on 2013 and 2016 because the extended properties are the same).
I've posted up a script module on GitHub here https://github.com/gscales/Powershell-Scripts/blob/master/ReportTagged.ps1 that can do this using the Extended properties so it will work on Exchange 2010 and up.
Report-TaggedFolders - Creates a Report of the FolderTag applied to each of the Folders in a Mailbox (if they are tagged). To get all the availbile Personal Tags the Exchange Management Shell Get-RetentionPolicyTag cmdlet is used. The script also then uses the Tag retrieved from the folder to report then number of Items in that folder that have that Tag applied and produces a report like
Report-UntaggedFolder - Creates a Report of the Untagged Folder in a Mailbox with the FolderClass, ItemCount and ItemSize.