So I'm checking for an approach on a problem I have.
I have an e-mail from my school (Office 365) and I wanted to print the email subject of each email that's located in my inbox with PowerShell.
I already have found the method to lay a connection
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://smtp.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
function Connect-O365 {
$session365 = New-PSSession `
-ConfigurationName Microsoft.Exchange `
-ConnectionUri "https://smtp.office365.com/powershell-liveid/" `
-Credential $UserCredential
-Authentication Basic `
-AllowRedirection
Import-Module (Import-PSSession $session365 -AllowClobber) -Global
}
And have found the Get-Mailbox
cmdlet.
The problem now however is that I haven't found any real examples or methods that continue to help me printing the email subjects.
I have done quite some research and didn't manage to find something like:
Get-Mailbox -Identity "user" |Select-MailBox * |Where-Object $_.MailBoxName = "Inbox"
Is this not possible or do I have to use another method?
Get-MessageTrackingLog
, that one displays subjects of messages, but if you want all the mailbox, your best bet would be connecting withOutlook.Application
(requires Office installed on local machine) and then parsing your inbox. - Vesper