Public/Configuration/Add-StandardMailsetup.ps1

function Add-StandardMailsetup {
    param(
        [string]$TenantId
    )

    try {
        Connect-CustomerExchange -CustomerTenantId $TenantId

        $mailbox = Get-Mailbox -ResultSize Unlimited | Select-Object UserPrincipalName, DisplayName | Out-ConsoleGridView -OutputMode Single -Title "Select mailbox to apply standard setup to"

        $upn = $mailbox.UserPrincipalName

        Set-MailboxRegionalConfiguration -Identity $upn -Language da-DK -DateFormat "dd-MM-yyyy" -TimeFormat "HH:mm" -LocalizeDefaultFolderName -TimeZone "Romance Standard Time"
        Set-MailboxFolderPermission $upn":\"$calendarName -User Default -AccessRights Reviewer
        Set-FocusedInbox -Identity $upn -FocusedInboxOn $false

        Write-ModuleLog -Message "Standard mail setup applied to $upn" -Level Info -Component 'Add-StandardMailsetup'


    } catch {
        throw $_
    }
}