The modern attachment feature doesn't work when web proxy used in Exchange Server 2016

This article helps you resolve the problem that the modern attachment feature doesn't work after you set the InternetWebProxy property.

Original KB number:   4056953

Symptoms

After you set the InternetWebProxy property by using the Set-ExchangeServer cmdlet in Microsoft Exchange Server 2016, the modern attachment feature doesn't work. An event like the following is logged on the Exchange Server:

Log Name: Application
Source: MSExchange OWA
Date: <Date>
Event ID: 164
Task Category: Configuration
Level: Error
Keywords: Classic
User: N/A
Computer: server.contoso.com
Description: There was a failure in finding the SharePoint endpoint. The document library and endpoint location couldn't be retrieved using "https://contoso123.sharepoint.com". System.Net.WebException: Unable to connect to the remote server The document library and endpoint location couldn't be retrieved using "https://contoso123.sharepoint.com". System.Net.WebException: Unable to connect to the remote server

Cause

OAuth authentication is used between Exchange Server 2016 and the web location (such as OneDrive) that stores the attachment. The InternetWebProxy property isn't supported by OAuth authentication.

Resolution

To resolve this issue, follow these steps:

  1. Locate and open each web.config file for the virtual directories: OWA, Mapi, EWS.

  2. Look for the proxy part of the web.config file, such as the following:

    <system.net>
        <defaultProxy>
            <proxy usesystemdefault="true" bypassonlocal="true" />
            <bypasslist>
    
  3. Add the proxy server with a port number, such as http://proxy.contoso.com:8080, and set the necessary bypass list:

    <system.net>
        <defaultProxy>
            <proxy usesystemdefault="false" bypassonlocal="true" proxyaddress="http://proxy.contoso.com:8080" />
            <bypasslist>
                <add address=".*\.contoso\.com" />
            </bypasslist>
        </defaultProxy>
    </system.net>