OneDrive and other notifications

Occasional Contributor



Doing a large deployment and have OneDrive and SharePoint deployed. Mail transition off Goog is in a couple months but wondering if there is a work around to send notifications outbound when someone shares a document from OneDrive. Since MS only looks internally first its sending the notification to their Outlook account which we've hidden. Any thoughts on how to send these sharing notifications outbound to our regular MX records? 

8 Replies

Credit goes to BitTitan for this solution.



The default mail routing can be manipulated by a mechanism called Criteria-Based Routing (CBR). Instead of dropping the mail in the mailbox on Office 365, we can intercept the message and transfer it to the original email system. The interception is based on criteria similiar to the membership of a specific Distribution List.

This is best explained by using the same example scenario:

  • John was migrated to Office 365 in the first batch.
  • Tom is part of a Distribution List (DL) called NotMigrated.
  • We have set up a CBR mechanism that defines the following:
    • If you are a part of the DL NotMigrated, your mail will be intercepted, and will be sent to the on-premises environment.
  • This way, when John sends an email to Tom, it will not go into the Office 365 mailbox, but instead be transferred to the On-Premises Exchange 2010+ environment.

More information can be found here:

Step-by-step setup:
For the setup, use PowerShell, because it is faster and easier to set up than working through the Office 365 admin portal. If you need information about how to do this through the Office 365 admin portal, contact Microsoft Support.

  1. Connect to Exchange Online PowerShell.
  2. Create the Distribution List (DL):
    New-DistributionGroup -Name "BtNotMigratedUsers"
  3. Add All Users to this DL.
  4. Create the Connector:
    $result = New-OutboundConnector -Name "CBRConnector" -ConnectorType OnPremises -SmartHosts "<fill smart host to source environment>" -UseMXRecord $false -IsTransportRuleScoped $true
    • Notes:
      • -SmartHosts entry needs to be set to the URL or IP Address of the Source environment server.
      • On Exchange 2003, 2007, and 2010, this will be the address of the Transport server.
      • On Exchange 2013 and 2016, this will be the address of the Mailbox server, not the Transport server.
      • If the Source environment is Hosted, you would need to obtain this address from the Hosted provider.
      • If the Source environment is G Suite, you would need to change the -SmartHosts entry to be the following: -SmartHosts “”
  5. Create Rule:
    $result = New-TransportRule -Name "PilotInABoxRule" -SentToMemberOf "BtNotMigratedUsers" -RouteMessageOutboundConnector "CBRConnector"

When a user is fully migrated, remove the user from the DL, and they will receive their email in their own Office 365 mailbox



Thanks, very helpful and will give this a shot. 

We were able to get this working and some of us were forwarding our mail from our google accounts into our o365 mail accounts.


Since this has been working the forward from google to o365 has stop as expected.

Is there any way to have a copy dropped into the o365 mailbox as well again without removing the user from the DL we created?


Just curious, why would you want to do this?

Basically until we switch over to Outlook we need notifications for when OneDrive docs are share. Additionally some folks like IT and power users are forwarding Gmail to Outlook to test filter and rule creations and just vet the experience. hope this makes sense. Its a temporary stop gap to ensure we test thoroughly and also ensure people are getting notifications when docs are shared with them.     

To be clear, you don't need to remove someone from the DL until the user is ready to exclusively use the O365 mailbox...
Is there a reason why you couldn't configure traditional forwarding directly on the individual O365 mailbox that you want to forward those notifications back to the corresponding user account at Google? This would essentially accomplish what the DL was providing, but allowing a local copy to be left in the O365 mailbox.

Thanks what you provided earlier works for us in the interim. Appreciate the help. The only issue is the formatting that comes over (even if you just forward manually) is very very ugly. I assume there is now way to change this correct? 


[cid:d1fb65ef-d343-444a-99ac-a7a284d3295b]      This link will work for anyone in  then super long links with a bunch of txt. 


Its a bandaid for now so we can live with the ugly links