Anavem
Languagefr
How to Save Sent Items in Shared Mailbox with PowerShell

How to Save Sent Items in Shared Mailbox with PowerShell

Configure Exchange Online shared mailboxes to store sent emails in the shared Sent Items folder instead of personal mailboxes using PowerShell commands for better collaboration and compliance.

Evan MaelEvan Mael
March 26, 2026 12 min
mediumexchange 9 steps 12 min

Why Configure Shared Mailbox Sent Items Storage?

By default, when users send emails from a shared mailbox in Exchange Online, those sent items are stored only in their personal Sent Items folder. This creates several challenges for organizations: team members can't see what emails were sent from the shared mailbox, compliance and auditing become difficult, and there's no centralized record of shared mailbox communications.

What Does This Configuration Actually Change?

The PowerShell commands in this tutorial modify two specific mailbox properties: MessageCopyForSentAsEnabled and MessageCopyForSendOnBehalfEnabled. When enabled, these settings ensure that sent emails are stored in both the sender's personal Sent Items folder and the shared mailbox's Sent Items folder. This dual storage approach maintains individual accountability while providing team visibility.

Which Exchange Environments Support This Feature?

This functionality works in Exchange Online (Microsoft 365) and Exchange Server on-premises versions 2013, 2016, and 2019. The feature originated in Exchange 2010 SP3 and has remained stable through 2026. While you can also configure this through the Microsoft 365 Admin Center for Exchange Online, PowerShell provides more control and is essential for bulk operations and on-premises environments.

Implementation Guide

Full Procedure

01

Install and Import ExchangeOnlineManagement Module

First, check if the ExchangeOnlineManagement module is already installed on your system. This module provides the necessary cmdlets to manage Exchange Online settings.

Get-Module -ListAvailable ExchangeOnlineManagement

If the module isn't installed, open PowerShell as Administrator and install it:

Install-Module -Name ExchangeOnlineManagement -Force -AllowClobber

Import the module into your current session:

Import-Module ExchangeOnlineManagement
Pro tip: Use the -Force -AllowClobber parameters to overwrite any existing versions and avoid conflicts with other Exchange modules.

Verification: Run Get-Command -Module ExchangeOnlineManagement | Select-Object Name | Measure-Object to confirm the module loaded successfully. You should see over 600 available commands.

02

Connect to Exchange Online

Establish a connection to your Exchange Online tenant using modern authentication. Replace the email address with your admin account:

Connect-ExchangeOnline -UserPrincipalName admin@contoso.com

This command will prompt for multi-factor authentication if enabled on your account. The connection uses OAuth 2.0 for secure authentication.

Warning: Ensure you're connecting with an account that has the necessary permissions. Global Admin or Exchange Admin roles are required to modify mailbox settings.

Verification: Run Get-OrganizationConfig | Select-Object Name to confirm you're connected to the correct tenant. The command should return your organization's name without errors.

03

Identify Target Shared Mailboxes

Before making changes, identify which shared mailboxes need configuration. List all shared mailboxes in your organization:

Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails SharedMailbox | Select-Object DisplayName, UserPrincipalName, MessageCopyForSentAsEnabled, MessageCopyForSendOnBehalfEnabled

This command shows the current state of the sent item copy settings. Look for mailboxes where both MessageCopyForSentAsEnabled and MessageCopyForSendOnBehalfEnabled are False.

To check a specific shared mailbox:

Get-Mailbox -Identity "shared@contoso.com" | Select-Object DisplayName, MessageCopyForSentAsEnabled, MessageCopyForSendOnBehalfEnabled

Verification: The output should display the current configuration. Note which mailboxes need the settings changed from False to True.

04

Configure Single Shared Mailbox

Enable sent item copying for a specific shared mailbox. This configuration affects both "Send As" and "Send On Behalf Of" scenarios:

# Enable for Send As permissions
Set-Mailbox -Identity "shared@contoso.com" -MessageCopyForSentAsEnabled $true

# Enable for Send On Behalf Of permissions
Set-Mailbox -Identity "shared@contoso.com" -MessageCopyForSendOnBehalfEnabled $true

Replace "shared@contoso.com" with your actual shared mailbox address. You can use the UserPrincipalName, alias, or display name as the identity.

For convenience, you can set both parameters in a single command:

Set-Mailbox -Identity "shared@contoso.com" -MessageCopyForSentAsEnabled $true -MessageCopyForSendOnBehalfEnabled $true
Pro tip: Always test with one mailbox first before running bulk operations. This helps identify any permission or configuration issues early.

Verification: Run Get-Mailbox -Identity "shared@contoso.com" | Select-Object MessageCopyForSentAsEnabled, MessageCopyForSendOnBehalfEnabled to confirm both values are now True.

05

Configure All Shared Mailboxes (Bulk Operation)

To enable sent item copying for all shared mailboxes in your organization, use this bulk operation script:

Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails SharedMailbox | ForEach-Object { 
    Write-Host "Configuring: $($_.DisplayName)" -ForegroundColor Green
    Set-Mailbox -Identity $_.UserPrincipalName -MessageCopyForSendOnBehalfEnabled $true -MessageCopyForSentAsEnabled $true -ErrorAction SilentlyContinue
}

This script processes each shared mailbox individually and includes error handling to continue if one mailbox fails. The Write-Host command provides progress feedback.

For organizations with many shared mailboxes, you might want to add a progress counter:

$SharedMailboxes = Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails SharedMailbox
$Counter = 0

$SharedMailboxes | ForEach-Object {
    $Counter++
    Write-Progress -Activity "Configuring Shared Mailboxes" -Status "Processing $($_.DisplayName)" -PercentComplete (($Counter / $SharedMailboxes.Count) * 100)
    Set-Mailbox -Identity $_.UserPrincipalName -MessageCopyForSendOnBehalfEnabled $true -MessageCopyForSentAsEnabled $true
}
Warning: Bulk operations can take time in large organizations. Consider running during maintenance windows to avoid impacting users.

Verification: After completion, run the identification command from Step 3 again to confirm all shared mailboxes now show True for both parameters.

06

Verify User Permissions

For the sent item copying to work properly, users must have the correct permissions on the shared mailbox. Check existing permissions:

# Check Send As permissions
Get-RecipientPermission -Identity "shared@contoso.com" | Where-Object {$_.Trustee -ne "NT AUTHORITY\SELF"} | Select-Object Trustee, AccessRights

# Check Send On Behalf Of permissions
Get-Mailbox -Identity "shared@contoso.com" | Select-Object GrantSendOnBehalfTo

If users need Send As permissions, grant them using:

Add-RecipientPermission -Identity "shared@contoso.com" -Trustee "user@contoso.com" -AccessRights SendAs -Confirm:$false

For Send On Behalf Of permissions:

Set-Mailbox -Identity "shared@contoso.com" -GrantSendOnBehalfTo @{Add="user@contoso.com"}

To add multiple users to Send On Behalf Of:

Set-Mailbox -Identity "shared@contoso.com" -GrantSendOnBehalfTo @{Add="user1@contoso.com","user2@contoso.com"}

Verification: Re-run the permission check commands to confirm users appear in the results with the correct access rights.

07

Test the Configuration

After configuration, test that sent items are properly saved to the shared mailbox. The changes may take up to 60 minutes to replicate fully across Exchange Online.

First, check the replication status by re-running the configuration check:

Get-Mailbox -Identity "shared@contoso.com" | Select-Object DisplayName, MessageCopyForSentAsEnabled, MessageCopyForSendOnBehalfEnabled

To test the functionality:

  1. Have a user with Send As or Send On Behalf Of permissions open Outlook
  2. Compose a new email using the shared mailbox as the "From" address
  3. Send the email to a test recipient
  4. Check both the user's personal Sent Items and the shared mailbox's Sent Items folder

The email should appear in both locations when the configuration is working correctly.

Pro tip: If using Outlook desktop, restart the application after making permission changes to ensure it recognizes the new settings.

For troubleshooting, you can also check the message trace:

Get-MessageTrace -SenderAddress "shared@contoso.com" -StartDate (Get-Date).AddHours(-2) -EndDate (Get-Date)

Verification: Confirm that sent emails appear in both the sender's personal Sent Items folder and the shared mailbox's Sent Items folder.

08

Monitor and Maintain the Configuration

Create a monitoring script to regularly check that your shared mailbox configurations remain correct. Save this script and run it periodically:

# Shared Mailbox Sent Items Configuration Report
$Report = @()
$SharedMailboxes = Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails SharedMailbox

foreach ($Mailbox in $SharedMailboxes) {
    $Report += [PSCustomObject]@{
        DisplayName = $Mailbox.DisplayName
        UserPrincipalName = $Mailbox.UserPrincipalName
        SendAsEnabled = $Mailbox.MessageCopyForSentAsEnabled
        SendOnBehalfEnabled = $Mailbox.MessageCopyForSendOnBehalfEnabled
        ConfigurationStatus = if ($Mailbox.MessageCopyForSentAsEnabled -and $Mailbox.MessageCopyForSendOnBehalfEnabled) { "Configured" } else { "Needs Configuration" }
    }
}

$Report | Format-Table -AutoSize
$Report | Export-Csv -Path "C:\Temp\SharedMailboxConfig_$(Get-Date -Format 'yyyyMMdd').csv" -NoTypeInformation

This script generates both a console display and a CSV file for record-keeping. Schedule it to run monthly to catch any configuration drift.

To fix any mailboxes that show "Needs Configuration":

$Report | Where-Object {$_.ConfigurationStatus -eq "Needs Configuration"} | ForEach-Object {
    Write-Host "Fixing: $($_.DisplayName)" -ForegroundColor Yellow
    Set-Mailbox -Identity $_.UserPrincipalName -MessageCopyForSentAsEnabled $true -MessageCopyForSendOnBehalfEnabled $true
}

Verification: The monitoring script should show all shared mailboxes with "Configured" status. Any showing "Needs Configuration" require attention.

09

Disconnect from Exchange Online

Always properly disconnect from Exchange Online when finished to free up connection resources and maintain security best practices:

Disconnect-ExchangeOnline -Confirm:$false

The -Confirm:$false parameter skips the confirmation prompt, making it suitable for automated scripts.

If you want to see the confirmation prompt for manual sessions:

Disconnect-ExchangeOnline

You can also check your current connection status before disconnecting:

Get-ConnectionInformation
Pro tip: Include the disconnect command in all your Exchange Online scripts to ensure clean session management, especially in automated environments.

Verification: Run Get-ConnectionInformation after disconnecting. The command should return no results, confirming the session is closed.

Frequently Asked Questions

Why are sent items from shared mailboxes not appearing in the shared Sent Items folder?+
By default, Exchange Online stores sent items only in the sender's personal mailbox, not the shared mailbox. You need to enable the MessageCopyForSentAsEnabled and MessageCopyForSendOnBehalfEnabled parameters using PowerShell. Additionally, users must have proper Send As or Send On Behalf Of permissions, and changes can take up to 60 minutes to replicate across Exchange Online.
What's the difference between MessageCopyForSentAsEnabled and MessageCopyForSendOnBehalfEnabled?+
MessageCopyForSentAsEnabled controls sent item copying when users have Send As permissions and send emails that appear to come directly from the shared mailbox. MessageCopyForSendOnBehalfEnabled controls copying when users have Send On Behalf Of permissions and emails show 'on behalf of' in the From field. Both should be enabled to cover all sending scenarios.
Can I configure shared mailbox sent items through the Microsoft 365 Admin Center instead of PowerShell?+
Yes, for Exchange Online you can use the Microsoft 365 Admin Center by navigating to Users > Shared mailboxes > Select mailbox > Mail tab > Enable 'Save sent items in this shared mailbox's Sent Items folder'. However, PowerShell is required for bulk operations, on-premises Exchange, and provides more reliable results, especially with newer Outlook clients.
How long does it take for shared mailbox sent item configuration changes to take effect?+
Configuration changes typically replicate within 15-60 minutes across Exchange Online. The actual time depends on your tenant's replication schedule and current system load. Users may need to restart Outlook desktop clients to recognize the new settings immediately. You can verify the configuration is active by checking that both parameters show True when querying the mailbox.
Will enabling sent item copying affect mailbox storage quotas?+
Yes, sent emails will now be stored in both the sender's personal mailbox and the shared mailbox, effectively doubling the storage usage for those messages. Shared mailboxes have a 50GB storage limit by default in Exchange Online. Monitor storage usage regularly and consider implementing retention policies or archiving for high-volume shared mailboxes to prevent quota issues.
Evan Mael
Written by

Evan Mael

Microsoft MCSA-certified Cloud Architect | Fortinet-focused. I modernize cloud, hybrid & on-prem infrastructure for reliability, security, performance and cost control - sharing field-tested ops & troubleshooting.

Discussion

Share your thoughts and insights

Sign in to join the discussion