From d68df88c4d9d827f0bd9b23440d15088dcfcc1de Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Mon, 11 Apr 2022 11:17:45 +0200 Subject: [PATCH] Add list-outlook-sent.ps1 --- Scripts/list-outlook-sent.ps1 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Scripts/list-outlook-sent.ps1 diff --git a/Scripts/list-outlook-sent.ps1 b/Scripts/list-outlook-sent.ps1 new file mode 100644 index 00000000..33e7f146 --- /dev/null +++ b/Scripts/list-outlook-sent.ps1 @@ -0,0 +1,23 @@ +<# +.SYNOPSIS + Lists Outlook's Sent Mails +.DESCRIPTION + This PowerShell script lists the mails in the Sent Mail folder of Outlook. +.EXAMPLE + PS> ./list-outlook-sent +.LINK + https://github.com/fleschutz/PowerShell +.NOTES + Author: Markus Fleschutz | License: CC0 +#> + +try { + $Outlook = New-Object -com Outlook.application + $MAPI = $Outlook.GetNameSpace("MAPI") + $Inbox = $MAPI.GetDefaultFolder(5) # 5 = olFolderSentMail + $Inbox.items | Select SentOn,Subject | Format-Table -AutoSize + exit 0 # success +} catch { + "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" + exit 1 +}