Applies to: Office 365 Exchange Online


Scenario

When attaching a file from a OneDrive location to an email in Outlook on the web (OWA), it gives you two options:
  1. Sharing as a OneDrive link.
  2. Attaching as a copy.


It's easy for a user to pick one and set that choice as the default option for the future sharings in the related prompt as seen in the image above.

There might also be cases where you need to set the default sharing preference as "attach as a copy" and leave OneDrive-sharing out for reasons like:
  • Users aren't allowed to share files in the cloud as linked attachments due to corporate policies.
  • A user raises a specific request providing a good business justification.
  • You simply don't want OneDrive shares to be created for every attachment that is meant to be sent with an email.
It can be done directly from the Mail settings in Outlook on the web (OWA) of the corresponding user(s):



However, if this change is supposed to be applied for a bunch of users, you'd need to handle things in bulk and remotely instead of asking users to take action themselves or helping them do so one by one.

Solution

To set Attachment Sharing Preference as "Attach as a Copy" in OWA for any users, you can follow the steps below in Exchange Online Powershell:

1- Create a new OWA Mailbox Policy and give it a name like "OwaMailboxPolicy-OneDriveDisabled":

New-OwaMailboxPolicy -Name "OwaMailboxPolicy-OneDriveDisabled"

https://docs.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/outlook-on-the-web/create-outlook-web-app-mailbox-policy

2- Disable "ReferenceAttachmentsEnabled" for the new policy:

Set-OwaMailboxPolicy -Identity "OwaMailboxPolicy-OneDriveDisabled" -ReferenceAttachmentsEnabled $false

https://docs.microsoft.com/en-us/powershell/module/exchange/client-access/set-owamailboxpolicy?view=exchange-ps

3- Assign the new policy to a pilot user for testing:

Set-CASMailbox -Identity nuck.chorris@contoso.com -OwaMailboxPolicy "OwaMailboxPolicy-OneDriveDisabled"

https://docs.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/outlook-on-the-web/apply-or-remove-outlook-web-app-mailbox-policy

4- The changes might take some time (up to a few hours) to be effective. After waiting for a while, test it out with the pilot user.

5- Once you make sure that you've done everything correctly and it works as desired, assign the new policy to all corresponding users.

If it's supposed to be in effect for all users in the organization without any exceptions, you can go with either of the following options:
  • Assign the new policy to every user using the cmdlet below:
    Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox | foreach {Set-CasMailbox -Identity $_.MicrosoftOnlineServicesID -OwaMailboxPolicy "OwaMailboxPolicy-OneDriveDisabled"}
  • Update the default OWA policy (OwaMailboxPolicy-Default) using the cmdlet in Step 2 and disable "ReferenceAttachmentsEnabled" for it. Personally I wouldn't recommend this, because having a default policy untouched can be a life-saver in case of any corruptions with the custom ones.
If you want to take the action back at some point, you can simply run the cmdlet in Step 2 and set "ReferenceAttachmentsEnabled" as $true instead of $false this time. As an easier approach, you can also assign the default policy back to the users.

Other Languages

See Also