This script can set user retention policy tag in Office 365 Exchange Online. You can also use this script to get user retention policy tags. This script is applicable for clients that target Exchange Online and versions of Exchange starting with Exchange Server 2013.
Currently, you can easily set email messages with retention policy enabled in Outlook and Outlook Web App (OWA). But you find it is not very convenient to set retention policy for email messages in a specific time range. You want to find a workaround to solve this problem.
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery