When using shared or delegated mailboxes with Office365 or Exchange 2013, any emails that are ‘sent as’ or ‘sent on behalf of’ the shared/delegated mailbox go into the senders mailbox instead of the shared/delegated mailbox.

There is a regitry fix for this if you’re using cached mode, but for online only users, there is no current workaround.

Some users have to work in online mode – Citrix and Remote Desktop users are an example, as if you’re using cached mode you have to target users to specific Citrix / RDP servers to ensure cache files aren’t taking up space on every single server, but that means no automatic fail-over in the event of a server failure.

I’ve written an Outlook macro that achieves the same as the registry hack that checks to see if the ‘sender name’ is the same as the ‘sent on behalf of’ name, and if it’s not will move the message to the shared / delegated mailbox.

To give this a test – open Outlook, press alt +F11, expand Project1, expand Microsoft Outlook Objects and double click on ThisOutlookSession, then paste the following code into the new window.

VBA macro to move to delegated or shared mailbox

Private WithEvents MProSend As Outlook.Items
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If MProSend Is Nothing Then
Application_Startup
End If
End Sub
Private Sub Application_Startup()
Dim objNS As Outlook.NameSpace
Dim objSentFolder As Outlook.MAPIFolder
Set objNS = Application.Session
Set MProSend = objNS.GetDefaultFolder(olFolderSentMail).Items
End Sub
Private Sub MProSend_ItemAdd(ByVal Item As Object)
Dim objNS2 As Outlook.NameSpace
Dim MProFolder As Folder
Set objNS2 = Outlook.GetNamespace("MAPI")
If TypeOf Item Is Outlook.MailItem Then
If Item.SentOnBehalfOfName <> Item.SenderName Then
strSenderName = Item.SentOnBehalfOfName
Set MProFolder = objNS2.Folders(strSenderName).Folders("Sent Items")
Item.Move MProFolder
End If
End If
Set objNS2 = Nothing
Set MProFolder = Nothing
End Sub

Hope it helps…

Leave a Reply

Your email address will not be published. Required fields are marked *