Skip to content

Instantly share code, notes, and snippets.

@gioxx gioxx/OldestMail.ps1
Last active Dec 5, 2018

Embed
What would you like to do?
Restituisce la data (e la cartella in cui è contenuto) il messaggio più vecchio mai ricevuto all'interno di una casella di posta elettronica Office 365, vedi https://wp.me/pdQ5q-9W3
<# O365 PShell Snippet: Get oldest message in a Mailbox
Autore (ver.-mod.): GSolone (0.1 ult.mod. 21/11/18)
Utilizzo: .\OldestMail.ps1 user@contoso.com
Info: https://gioxx.org/tag/o365-powershell
#>
# Verifica parametri da prompt
Param(
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]
[string] $SourceMailbox
)
Get-MailboxFolderStatistics -IncludeOldestAndNewestItems -Identity $SourceMailbox |
Where OldestItemReceivedDate -ne $null |
Sort OldestItemReceivedDate |
Select -First 1 OldestItemReceivedDate,FolderPath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.