Setting up the custom EWS address in Exchange Rules family software
The below solution is applicable only for CodeTwo Exchange Rules of versions listed in the right-hand side section "Applies to". If you are looking for similar article for CodeTwo Exchange Rules of higher versions than listed aside, please refer to the other Knowledge Base article.
In some cases the Sent Items Update service in Exchange Rules 2007/2010 might have difficulty connecting to the EWS (Exchange Web Services) service. The user can find the information about this problem in the Sent Items Update service log files.
2. Log files
To check the location of the Sent Items Update service log files open the Exchange Rules Administration program:
- for Exchange 2007 click Start, Programs, CodeTwo, CodeTwo ExchangeRules 2007, Administration
- for Exchange 2010 click Start, Programs, CodeTwo, CodeTwo ExchangeRules 2010, Administration
Next from the Tools menu choose Open in the Sent Items Update Log files section (Fig. 1.)
3. Types of problems
To learn the EWS address the Sent Items Update service connects first to the Autodiscover service that returns the EWS address. If Autodiscover is unavailable or returns a wrong address, the Sent Items Update module will try to connect to EWS with the default address https://localhost/ews/exchange.asmx.
If this connection also fails, the SentItemsUpdate module will not work. The solution is to manually set the EWS address in the Exchange Rules configuration file. Below are examples of typical EWS and Autodiscover communication failures:
Case 1. CodeTwo Update Agent user does not have rights to access the Autodiscover service
15.07.2010 16:11:56 7a0 AutodiscoverUrl(); Exc: The remote server returned an error: (401) Unauthorized. ... 15.07.2010 16:11:56 7a0 AutodiscoverUrl(); EmailAddress: firstname.lastname@example.org 15.07.2010 16:11:56 7a0 AutodiscoverUrl(); WithTest: True 15.07.2010 16:11:56 7a0 AutodiscoverUrl(); host: https://vjb-es2k7-x64.ex.local/Autodiscover/Autodiscover.xml ...
Case 2. Cannot connect to EWS (see 4. Setting the custom EWS address below)
15.07.2010 15:40:25 1004 TestEws(); EWS-url: https://vjb-es2k7-x64.ex.local_wrong_address/EWS/Exchange.asmx 15.07.2010 15:40:28 1004 TestEws(); Exc: Unable to connect to EWS on address: https://vjb-es2k7-x64.ex.local_wrong_address/EWS/Exchange.asmx. The remote name could not be resolved: 'vjb-es2k7-x64.ex.local_wrong_address'... ...
Case 3. CodeTwo Update Agent user does not have rights to access the EWS service (see 5. Setting up the EWS permissions and rights for the CodeTwo Update Agent user below)
22.07.2010 14:15:20 1014 MakeRawSoapRequest(); Exc: The remote server returned an error: (401) Unauthorized. ... 22.07.2010 14:15:20 1014 MakeRawSoapRequest(); EWS-Url: https://localhost/ews/exchange.asmx ...
4. Setting the custom EWS address
To manually configure the custom EWS address in the configuration file open (e.g. in Notepad) the SentItemsUpdater.Service.exe.config file. The default location of the config file is C:\Program Files\CodeTwo\CodeTwo ExchangeRules 2007 or C:\Program Files\CodeTwo\CodeTwo ExchangeRules 2010. Add the new key entry EWSUrl in front of the <appSettings> string with the value set to the custom EWS address (remember to replace YOUR_HOST with your host name). See the example below.
Note: You can add EWSUrl only if this key is not present in the config file - otherwise modify the value of the already existing key.
<appSettings> ... <add key="EWSUrl" value="https://YOUR_HOST/EWS/Exchanges.asmx" /> </appSettings>
If the EWSUrl entry is present in the config file but it is marked as the comment - remove comment tags (marked red).
<appSettings> ... <!-- <add key="EWSUrl" value="https://YOUR_HOST/EWS/Exchanges.asmx" /> --> </appSettings>
Make sure the EWS address is correct. To do this open the web browser, paste the address into it and hit Enter (logged in user must have administrator's rights). The effect should be as in the picture below (Fig. 2.)
Fig. 2. EWS address opened in the web browser (https://localhost/EWS/Exchange.asmx)
After saving the modified config file remember to restart the Sent Items Update service (Fig. 3.).
5. Setting up the EWS permissions and rights for the CodeTwo Update Agent user
Make sure the Code Two Update Agent user has sufficient access rights to access the EWS service.To change or set permissions and rights to access EWS for the CodeTwo Update Agent user go to the Internet Information Services (IIS) Manager. Click Start menu, Settings, Control Panel, Administrative Tools, Internet Information Services (IIS) Manager. Expand Web Sites, Default Web Sites, right click EWS and choose Permissions. Click Add... and type in the CodeTwo Update Agent user name (Fig. 4.).
Minimum permissions are as below (Fig. 5.).