Using classic Outlook for Windows in business environments
Please note that Q&A forum is a public platform, and moderators will modify the question to hide personal information in the description. Kindly ensure that you hide any personal or organizational information the next time you post an error or other details to protect personal data.
Based on your description, I have conducted some test in my environment and found that you have 3 options in this context, you can try each and get back to me with the results:
Option 1: Using Export build-in function
Kindly follow the below instructions:
- At the top of the ribbon in classic Outlook, choose File.
- Choose Open & Export > Import/Export.
- Choose Export to a file > Next.
- Choose this option >> Next until finish export the file
However, the built-in export includes many columns but does not let you choose specific columns. You'll get fields like Subject, From, To, Received, etc. mixed in with many others. So, you'll need to open the CSV in Excel and delete the unwanted columns afterwards.
Option 2: Custom View + copy to Excel
- Go to View > Current View > View Settings > Columns
- Add only: Date Received, From, To, Subject > remove all others
- Also go to View > View Settings > Sort > Sort by Date Received
- Press Ctrl+A to select all emails and Copy (Ctrl+C) and paste into Excel
Kindly note that Outlook's built-in "From" and "To" columns only show the display name does not include domain
Option 3: Using PowerShell
This is the approach, which is closest to your requirement, please make sure Outlook is open and logged in and run the cmdlet below:
Connect-ExchangeOnline
$outlook = New-Object -ComObject Outlook.Application
$inbox = $outlook.GetNamespace("MAPI").GetDefaultFolder(6)
$SMTP_TAG = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
$emails = foreach ($item in $inbox.Items) {
if ($item -is [Microsoft.Office.Interop.Outlook.MailItem]) {
# 1. Try to get Sender SMTP silently
$fromAddress = $null
try {
$fromAddress = $item.PropertyAccessor.GetProperty($SMTP_TAG)
} catch {
$fromAddress = $item.SenderEmailAddress
}
# 2. Try to get Recipient SMTPs silently
$toAddresses = @()
foreach ($recip in $item.Recipients) {
if ($recip.Type -eq 1) {
try {
$addr = $recip.PropertyAccessor.GetProperty($SMTP_TAG)
if ([string]::IsNullOrWhiteSpace($addr)) { $addr = $recip.Address }
$toAddresses += $addr
} catch {
$toAddresses += $recip.Address
}
}
}
[PSCustomObject]@{
"Date Received" = $item.ReceivedTime.ToString("MM/dd/yyyy")
"From" = $fromAddress
"To" = $toAddresses -join "; "
"Subject" = $item.Subject
}
}
}
$emails | Export-Csv -Path "$env:USERPROFILE\Desktop\clean_emails.csv" -NoTypeInformation -Encoding utf8
Write-Host "Export complete! No errors this time." -ForegroundColor Green
My result:
Hope my answer will help you.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.