O365 Shared Mailboxes – sent items go into users folder

The default behaviour for items sent from a shared mailbox is to go into the users sent items. We had a requirement to save a copy in the shared mailbox sent items folder.

this script modifies the mailbox so that email sent either “on behalf” or “as” the mailbox get copied into the shared mailbox’s sent items:

$mailboxes = get-mailbox -resultsize unlimited -RecipientTypeDetails SharedMailbox
foreach ($mailbox in $mailboxes){
    write-host "trying " $mailbox.DisplayName -ForegroundColor Green
    set-mailbox $mailbox.displayname -MessageCopyForSendOnBehalfEnabled $True
    set-mailbox $mailbox.displayname -MessageCopyForSendOnBehalfEnabled $True}
    write-host "An error occured on " $mailbox.DisplayName -ForegroundColor red


Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.