mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-19 00:18:20 +02:00
Add list-outlook-inbox.ps1
This commit is contained in:
parent
149bf8baf8
commit
b1106be615
23
Scripts/list-outlook-inbox.ps1
Normal file
23
Scripts/list-outlook-inbox.ps1
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Lists Outlook's Inbox
|
||||||
|
.DESCRIPTION
|
||||||
|
This PowerShell script lists the emails in the inbox of Outlook.
|
||||||
|
.EXAMPLE
|
||||||
|
PS> ./list-outlook-inbox
|
||||||
|
.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(6) # 6 = olFolderInbox
|
||||||
|
$Inbox.items | Select Received,Subject | Format-Table -AutoSize
|
||||||
|
exit 0 # success
|
||||||
|
} catch {
|
||||||
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
exit 1
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user