After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 765398 - Online GAL contacts can have incorrect email address
Online GAL contacts can have incorrect email address
Status: RESOLVED FIXED
Product: evolution-ews
Classification: Other
Component: Contacts (Global Address List)
3.20.x
Other Linux
: Normal normal
: ---
Assigned To: Evolution EWS maintainer(s)
Evolution EWS maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-04-21 21:39 UTC by Brett
Modified: 2016-05-05 14:29 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Brett 2016-04-21 21:39:38 UTC
Evolution-ews had been working flawlessly to autofill and lookup global contacts from the exchange LDAP server.  Since the 3.20 update, global contacts are not returned correctly.  They have extra fields appended, or smtp: or sip: prepended.  Evolution cannot understand the returned emails to successfully send the message.  In some cases, the prepended characters can be deleted and the send works.  In others, there is no email address returned, just seemingly random LDAP fields, so I have to find email addresses from the company web site.

For example, one contact I use daily to communicate with an employee now returns this:

Ch.....lo <smtp:Ch...llo@exchange.uthscsa.edu>,

Another returns this:

Thompson <X400:C=US;A= ;P=U....A;O=UT.....A;S=Thompson;G=C..y S........r;>, 

In the second example the domain can be determined (all contacts in the list have the same domain, but the username is not returned, so I cannot determine the correct address.
Comment 1 Milan Crha 2016-04-26 18:01:34 UTC
Thanks for a bug report. I tried to reproduce this, but no luck. It can be that my exchange server is configured differently than yours. One important question, do you have the EWS account configured to use offline GAL, or not? The option can be found in the mail account properties, at the Receiving Options tab, at the bottom section called "Global Address List". I guess you've the "Cache offline address book" option turned off, right?

It would be also great, in case you've it off, if you could provide a response for one contact, with censored private data by replacing letters with for example 'x' letter, thus I could check what the server actually returns. To get such log, please close the evolution, then open a terminal and run on it:

   $ EWS_DEBUG=2 /usr/libexec/evolution-addressbook-factory -w

After, say, 5 seconds run the evolution and create a new message where you'll try to auto-complete with the test user. The console with the addressbook factory should show new output, where some part will contain the same email address as you'll see in the UI. I'm interested in the whole part of it. If you are unsure of what to delete and what not, then feel free to send the log only to me, I'll check its content and will delete it as soon as possible.

Nonetheless, I noticed that the "online" GAL returns only surname, which is a significant change from the previous behaviour. One related bug report can be bug #763430.
Comment 2 Milan Crha 2016-04-27 17:16:19 UTC
I think I found the issue and I tried to address it with the below change. I'd still appreciate if you could give me the response from your server, thus I'd be able to verify that the change works properly. I found one contact where I had filled two email addresses, one prefixed with "smtp:" and another with "SMTP:". The evolution-ews checked only for the later, case sensitively. That is fixed too.

Unfortunately I overlooked one regression with the first commit in the development version, thus that contains two commits, while I merged them into one for the stable branch.

Created commit 6da30fc and commit 924c45d in ews master (3.21.2+)
Created commit 31299ec in ews gnome-3-20 (3.20.2+)
Comment 3 Brett 2016-05-02 15:57:11 UTC
Cache offline address book is indeed turned off.

Not sure how to format code in this editor, sorry :\

I get this:
$ EWS_DEBUG=2 /usr/libexec/evolution-addressbook-factory -w
bash: /usr/libexec/evolution-addressbook-factory: No such file or directory

I got no addressbook factory, just the normal evolution window when I reopened the typical way.

Here are the results returned for one contact in the list (this person has a unique last name within the address book, so these all refer back to this one entry:

Chxxxxxo <eum:+1xxxxxxxxx3;phone-context=NEC-PBX-Non-Lync.win.xxxxx.edu>, Chxxxxxo <EUM:7xxx3;phone-context=NEC-PBX-Non-Lync.win.xxxx.edu>, Chxxxxxo <smtp:Chxxxo@exchange.xxxxxx.edu>, 

How can I test your new commit?  

Here is my uname:
Linux apxxxxxxh 4.5.0-1-ARCH #1 SMP PREEMPT Tue Mar 15 09:41:03 CET 2016 x86_64 GNU/Linux
Comment 4 Brett 2016-05-02 16:06:47 UTC
OK, I figured our where my addressbook-factory is located in my distro and got it to work.  

$ EWS_DEBUG=2 /usr/lib//evolution-data-server/evolution-addressbook-factory -w
> POST /EWS/Exchange.asmx HTTP/1.1
> Soup-Debug-Timestamp: 1462204748
> Soup-Debug: SoupSessionAsync 1 (0x7fd95c00b110), ESoapMessage 1 (0x7fd95c092150), SoupSocket 1 (0x7fd97c007760)
> Host: owa.XXXXXX.edu
> User-Agent: Evolution/3.20.1
> Connection: Keep-Alive
> Content-Type: text/xml; charset=utf-8
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header><types:RequestServerVersion xmlns:types="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2007_SP1"/></SOAP-ENV:Header><SOAP-ENV:Body xmlns:messages="http://schemas.microsoft.com/exchange/services/2006/messages"><messages:GetFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/types"><messages:FolderShape><BaseShape>Default</BaseShape></messages:FolderShape><messages:FolderIds><DistinguishedFolderId Id="inbox"/></messages:FolderIds></messages:GetFolder></SOAP-ENV:Body></SOAP-ENV:Envelope>
  
< HTTP/1.1 401 Unauthorized
< Soup-Debug-Timestamp: 1462204748
< Soup-Debug: ESoapMessage 1 (0x7fd95c092150)
< Server: Microsoft-IIS/7.5
< Set-Cookie: exchangecookie=1cf303e5c37643a5a344187190b47f79; expires=Tue, 02-May-2017 15:59:08 GMT; path=/; HttpOnly
< WWW-Authenticate: Negotiate
< WWW-Authenticate: NTLM
< WWW-Authenticate: Basic realm="owa.XXXXXX.edu"
< X-Powered-By: ASP.NET
< Date: Mon, 02 May 2016 15:59:07 GMT
< Content-Length: 0
< Set-Cookie: NSC_fy2010-ttm=ffffffff0967eb7245525d5f4f58455e445a4a42378b;Version=1;path=/;secure;httponly
  
> POST /EWS/Exchange.asmx HTTP/1.1
> Soup-Debug-Timestamp: 1462204748
> Soup-Debug: SoupSessionAsync 1 (0x7fd95c00b110), ESoapMessage 1 (0x7fd95c092150), SoupSocket 1 (0x7fd97c007760), restarted
> Host: owa.XXXXXX.edu
> User-Agent: Evolution/3.20.1
> Connection: Keep-Alive
> Content-Type: text/xml; charset=utf-8
> Content-Length: 842
> Authorization: Basic [XXXXXX\XXXXXX:**************]
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header><types:RequestServerVersion xmlns:types="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2007_SP1"/></SOAP-ENV:Header><SOAP-ENV:Body xmlns:messages="http://schemas.microsoft.com/exchange/services/2006/messages"><messages:GetFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/types"><messages:FolderShape><BaseShape>Default</BaseShape></messages:FolderShape><messages:FolderIds><DistinguishedFolderId Id="inbox"/></messages:FolderIds></messages:GetFolder></SOAP-ENV:Body></SOAP-ENV:Envelope>
  
< HTTP/1.1 200 OK
< Soup-Debug-Timestamp: 1462204748
< Soup-Debug: ESoapMessage 1 (0x7fd95c092150)
< Cache-Control: private
< Transfer-Encoding: chunked
< Content-Type: text/xml; charset=utf-8
< Server: Microsoft-IIS/7.5
< X-AspNet-Version: 2.0.50727
< X-Powered-By: ASP.NET
< Date: Mon, 02 May 2016 15:59:07 GMT
  

 The response code: 200
 The response headers for message 0x7fd95c092150
 =====================
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Mon, 02 May 2016 15:59:07 GMT

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" MajorVersion="14" MinorVersion="3" MajorBuildNumber="210" MinorBuildNumber="2" Version="Exchange2010_SP2"/>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <m:GetFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <m:ResponseMessages>
        <m:GetFolderResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Folders>
            <t:Folder>
              <t:FolderId Id="AAMkADAzMDAzMTdiLTk3ZDktNGExMS05ODFmLTk5NDJlYjYwMTMxMwAuAAAAAAALvXRo/c/WEYalAJAnka/OAQBjOJMRWJjTEYZhAJAnka/OAAABYhs4AAA=" ChangeKey="AQAAABYAAAD2qniOpRrkRpqwe1NGdoNCAAFfkQRy"/>
              <t:DisplayName>Inbox</t:DisplayName>
              <t:TotalCount>13289</t:TotalCount>
              <t:ChildFolderCount>1</t:ChildFolderCount>
              <t:UnreadCount>4043</t:UnreadCount>
            </t:Folder>
          </m:Folders>
        </m:GetFolderResponseMessage>
      </m:ResponseMessages>
    </m:GetFolderResponse>
  </s:Body>
</s:Envelope>
> POST /EWS/Exchange.asmx HTTP/1.1
> Soup-Debug-Timestamp: 1462204748
> Soup-Debug: SoupSessionAsync 1 (0x7fd95c00b110), ESoapMessage 2 (0x7fd95c092dd0), SoupSocket 1 (0x7fd97c007760)
> Host: owa.XXXXXX.edu
> User-Agent: Evolution/3.20.1
> Connection: Keep-Alive
> Content-Type: text/xml; charset=utf-8
> Authorization: Basic [XXXXXX\XXXXXX:**************]
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header><types:RequestServerVersion xmlns:types="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2010_SP2"/></SOAP-ENV:Header><SOAP-ENV:Body xmlns:messages="http://schemas.microsoft.com/exchange/services/2006/messages"><messages:SyncFolderItems xmlns="http://schemas.microsoft.com/exchange/services/2006/types"><messages:ItemShape><BaseShape>IdOnly</BaseShape></messages:ItemShape><messages:SyncFolderId><FolderId Id="AAMkADAzMDAzMTdiLTk3ZDktNGExMS05ODFmLTk5NDJlYjYwMTMxMwAuAAAAAAALvXRo/c/WEYalAJAnka/OAQBjOJMRWJjTEYZhAJAnka/OAAABZVXlAAA="/></messages:SyncFolderId><messages:SyncState>H4sIAAAAAAAEAO29B2AcSZYlJi9tynt/SvVK1+B0oQiAYBMk2JBAEOzBiM3mkuwdaUcjKasqgcplVmVdZhZAzO2dvPfee++999577733ujudTif33/8/XGZkAWz2zkrayZ4hgKrIHz9+fB8/In6NX+PX+TXoOfjF+w+P9+/d3znePnlwfLC9f3xyb/vJyZOT7Wd7Tw5Onjx49vD+/Z1f8t3X49fXy+nrNmvzk2yZ1de/xqP3f/NZVc7y+mz2azx8/3d/Mq+bolr+Gofv/+p36f/1IqvfypCTX+PX+C3oa0WmzRcNWv4avzl9tUP/H6PNb/j3t/P/81/8N37zP+Iv/zX+pI//5L/xX/g1f43pwZ/6m//ef9a/+pv/EZl88mv8Gr9m/tV//mv8Gr/2r/Gb/Bq/Fl759X+NX+P/+DV/jV/ji+OXZ18cv8Anv8az+89+8tf+NfpPSu1+F+/v34P+/psj7brP//rXvPsT/vLf4T979uf8Tb/49bPLP/TJr/lrvMLHv+av+fv/yb/WP/Cy9/Wv/Wv8mr//r/VH//Ovmvblr/0n/S3/6stf48/4NR79ev/OH/5nPfsb/8Wf+mf+uN/rD/rbQY7PX/0Rv88f+Ye+/DV+w1/65/w1f+Tsf/j8z/nz/5Q3r/6kkzu/7q/xa/xav8Of+mp37+Wv8Zv+6p/4tX7ff/0PefL3vfkr/9ovf510Ql/9mn/kb/Xqq1/y8tc4/1N+nf/pZ37yX3/+16//mP/13/yH/p1/79f7NX6N3+FfSPvUwiu/+L/8NR88OftvX73+yVff+/6r37/qI+yN59f5b/6/OJ7/+zf8g/4fUvenqVgDAAA=</messages:SyncState><messages:MaxChangesReturned>500</messages:MaxChangesReturned></messages:SyncFolderItems></SOAP-ENV:Body></SOAP-ENV:Envelope>
  
< HTTP/1.1 200 OK
< Soup-Debug-Timestamp: 1462204748
< Soup-Debug: ESoapMessage 2 (0x7fd95c092dd0)
< Cache-Control: private
< Transfer-Encoding: chunked
< Content-Type: text/xml; charset=utf-8
< Server: Microsoft-IIS/7.5
< X-AspNet-Version: 2.0.50727
< X-Powered-By: ASP.NET
< Date: Mon, 02 May 2016 15:59:07 GMT
  

 The response code: 200
 The response headers for message 0x7fd95c092dd0
 =====================
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Mon, 02 May 2016 15:59:07 GMT

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" MajorVersion="14" MinorVersion="3" MajorBuildNumber="210" MinorBuildNumber="2" Version="Exchange2010_SP2"/>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <m:SyncFolderItemsResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <m:ResponseMessages>
        <m:SyncFolderItemsResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:SyncState>H4sIAAAAAAAEAO29B2AcSZYlJi9tynt/SvVK1+B0oQiAYBMk2JBAEOzBiM3mkuwdaUcjKasqgcplVmVdZhZAzO2dvPfee++999577733ujudTif33/8/XGZkAWz2zkrayZ4hgKrIHz9+fB8/In6NX+PX+TXoOfjF+w+P9+/d3znePnlwfLC9f3xyb/vJyZOT7Wd7Tw5Onjx49vD+/Z1f8t3X49fXy+nrNmvzk2yZ1de/xqP3f/NZVc7y+mz2azx8/3d/Mq+bolr+Gofv/+p36f/1IqvfypCTX+PX+C3oa0WmzRcNWv4avzl9tUP/H6PNb/j3t/P/81/8N37zP+Iv/zX+pI//5L/xX/g1f43pwZ/6m//ef9a/+pv/EZl88mv8Gr9m/tV//mv8Gr/2r/Gb/Bq/Fl759X+NX+P/+DV/jV/ji+OXZ18cv8Anv8az+89+8tf+NfrPS/r/7+L9XdH//+ZIu+7zv/417/6Ev/x3+M+e/Tl/0y9+/ezyD33ya/4ar/Dxr/lr/v5/8q/zf7zsff1r/xq/5u//a/3R//yrpn35a/9Jf8u/+vLX+DN+jUe/3r/zh/9Zz/7Gf/Gn/pk/7vf6g/52kOPzV3/E7/NH/qEvf43f8Jf+OX/NHzn7Hz7/c/78P+XNqz/p5M6v+2v8Gr/W7/Cnvtrde/lr/Ka/+id+rd/3X/9Dnvx9b/7Kv/bLXyed0Fe/5h/5W7366pe8/DXO/5Rf53/6mZ/815//9es/5n/9N/+hf+ff+/V+jV/jd/gX0j618Mov/i9/zQdPzv7bV69/8tX3vv/q96/6CPvj+W/+vzie//s3/IP+H1e3QYJYAwAA</m:SyncState>
          <m:IncludesLastItemInRange>true</m:IncludesLastItemInRange>
          <m:Changes/>
        </m:SyncFolderItemsResponseMessage>
      </m:ResponseMessages>
    </m:SyncFolderItemsResponse>
  </s:Body>
</s:Envelope>
> POST /EWS/Exchange.asmx HTTP/1.1
> Soup-Debug-Timestamp: 1462204749
> Soup-Debug: SoupSessionAsync 1 (0x7fd95c00b110), ESoJonathanapMessage 3 (0x7fd95c092600), SoupSocket 1 (0x7fd97c007760)
> Host: owa.XXXXXX.edu
> User-Agent: Evolution/3.20.1
> Connection: Keep-Alive
> Content-Type: text/xml; charset=utf-8
> Authorization: Basic [XXXXXX\XXXXXX:**************]
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header><types:RequestServerVersion xmlns:types="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2007_SP1"/></SOAP-ENV:Header><SOAP-ENV:Body xmlns:messages="http://schemas.microsoft.com/exchange/services/2006/messages"><messages:GetFolder xmlns="http://schemas.microsoft.com/exchange/services/2006/types"><messages:FolderShape><BaseShape>Default</BaseShape></messages:FolderShape><messages:FolderIds><DistinguishedFolderId Id="inbox"/></messages:FolderIds></messages:GetFolder></SOAP-ENV:Body></SOAP-ENV:Envelope>
  
< HTTP/1.1 200 OK
< Soup-Debug-Timestamp: 1462204749
< Soup-Debug: ESoapMessage 3 (0x7fd95c092600)
< Cache-Control: private
< Transfer-Encoding: chunked
< Content-Type: text/xml; charset=utf-8
< Server: Microsoft-IIS/7.5
< X-AspNet-Version: 2.0.50727
< X-Powered-By: ASP.NET
< Date: Mon, 02 May 2016 15:59:08 GMT
  

 The response code: 200
 The response headers for message 0x7fd95c092600
 =====================
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Mon, 02 May 2016 15:59:08 GMT

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" MajorVersion="14" MinorVersion="3" MajorBuildNumber="210" MinorBuildNumber="2" Version="Exchange2010_SP2"/>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <m:GetFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <m:ResponseMessages>
        <m:GetFolderResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:Folders>
            <t:Folder>
              <t:FolderId Id="AAMkADAzMDAzMTdiLTk3ZDktNGExMS05ODFmLTk5NDJlYjYwMTMxMwAuAAAAAAALvXRo/c/WEYalAJAnka/OAQBjOJMRWJjTEYZhAJAnka/OAAABYhs4AAA=" ChangeKey="AQAAABYAAAD2qniOpRrkRpqwe1NGdoNCAAFfkQRy"/>
              <t:DisplayName>Inbox</t:DisplayName>
              <t:TotalCount>13289</t:TotalCount>
              <t:ChildFolderCount>1</t:ChildFolderCount>
              <t:UnreadCount>4043</t:UnreadCount>
            </t:Folder>
          </m:Folders>
        </m:GetFolderResponseMessage>
      </m:ResponseMessages>
    </m:GetFolderResponse>
  </s:Body>
</s:Envelope>
> POST /EWS/Exchange.asmx HTTP/1.1
> Soup-Debug-Timestamp: 1462204759
> Soup-Debug: SoupSessionAsync 1 (0x7fd95c00b110), ESoapMessage 4 (0x7fd95c0922e0), SoupSocket 1 (0x7fd97c007760)
> Host: owa.XXXXXX.edu
> User-Agent: Evolution/3.20.1
> Connection: Keep-Alive
> Content-Type: text/xml; charset=utf-8
> Authorization: Basic [XXXXXX\XXXXXX:**************]
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header><types:RequestServerVersion xmlns:types="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2010_SP2"/></SOAP-ENV:Header><SOAP-ENV:Body xmlns:messages="http://schemas.microsoft.com/exchange/services/2006/messages"><messages:ResolveNames xmlns="http://schemas.microsoft.com/exchange/services/2006/types" SearchScope="ActiveDirectory" ReturnFullContactData="true"><messages:UnresolvedEntry>XXXXXX</messages:UnresolvedEntry></messages:ResolveNames></SOAP-ENV:Body></SOAP-ENV:Envelope>
  
< HTTP/1.1 200 OK
< Soup-Debug-Timestamp: 1462204759
< Soup-Debug: ESoapMessage 4 (0x7fd95c0922e0)
< Cache-Control: private
< Transfer-Encoding: chunked
< Content-Type: text/xml; charset=utf-8
< Server: Microsoft-IIS/7.5
< X-AspNet-Version: 2.0.50727
< X-Powered-By: ASP.NET
< Date: Mon, 02 May 2016 15:59:19 GMT
  

 The response code: 200
 The response headers for message 0x7fd95c0922e0
 =====================
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Mon, 02 May 2016 15:59:19 GMT

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" MajorVersion="14" MinorVersion="3" MajorBuildNumber="210" MinorBuildNumber="2" Version="Exchange2010_SP2"/>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <m:ResolveNamesResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
      <m:ResponseMessages>
        <m:ResolveNamesResponseMessage ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:ResolutionSet TotalItemsInView="1" IncludesLastItemInRange="true">
            <t:Resolution>
              <t:Mailbox>
                <t:Name>XXXXXX, XXXXXX M</t:Name>
                <t:EmailAddress>XXXXXX@XXXXXX.edu</t:EmailAddress>
                <t:RoutingType>SMTP</t:RoutingType>
                <t:MailboxType>Mailbox</t:MailboxType>
              </t:Mailbox>
              <t:Contact>
                <t:DisplayName>XXXXXX, XXXXXXX M</t:DisplayName>
                <t:Culture>en-US</t:Culture>
                <t:GivenName>XXXXXXX</t:GivenName>
                <t:EmailAddresses>
                  <t:Entry Key="EmailAddress1">eum:+1XXXXXXXXXX;phone-context=NEC-PBX-Non-Lync.win.XXXXXX.edu</t:Entry>
                  <t:Entry Key="EmailAddress2">EUM:7XXXX;phone-context=NEC-PBX-Non-Lync.win.XXXXXX.edu</t:Entry>
                  <t:Entry Key="EmailAddress3">smtp:XXXXXX@exchange.XXXXXX.edu</t:Entry>
                </t:EmailAddresses>
                <t:PhoneNumbers>
                  <t:Entry Key="BusinessPhone">+1 210 XXX XXXX</t:Entry>
                </t:PhoneNumbers>
                <t:ContactSource>ActiveDirectory</t:ContactSource>
                <t:Department>XXXXXXX</t:Department>
                <t:JobTitle>Research Assistant</t:JobTitle>
                <t:OfficeLocation>XXXXXXX</t:OfficeLocation>
                <t:Surname>XXXXXX</t:Surname>
              </t:Contact>
            </t:Resolution>
          </m:ResolutionSet>
        </m:ResolveNamesResponseMessage>
      </m:ResponseMessages>
    </m:ResolveNamesResponse>
  </s:Body>
</s:Envelope>
Comment 5 Milan Crha 2016-05-03 10:04:48 UTC
Thanks for the update. It's an interesting result for me, I guess you made the change the same, thus the two email addresses returned by the server really differ:
> <t:Mailbox>
>    <t:Name>XXXXXX, XXXXXX M</t:Name>
>    <t:EmailAddress>XXXXXX@XXXXXX.edu</t:EmailAddress>
> ...
> <t:EmailAddresses>
>    <t:Entry Key="EmailAddress3">smtp:XXXXXX@exchange.XXXXXX.edu</t:Entry>
> ...

I'd expect that they will be the same, as they both are SMTP. The above fix skips those "eum:" email addresses and strips that (lowercase) "smtp:" prefix at the EmailAddress3. It will also use this email address, instead of the one provided at the Mailbox.

(In reply to Brett from comment #3)
> How can I test your new commit?  

By building evolution-ews from sources. Building as such is not trivial, thus if you are not used to it, then it might be better to wait for a release and test the change once it reaches your distribution. Eventually ask the distribution maintainer to provide you with a patched evolution-ews (test) build, or test in a virtual machine with a distribution which provides more recent version, in case your current distribution wouldn't offer the release version with the patch soon. The 3.20.2 release is planned for the May 9th.
Comment 6 Brett 2016-05-03 15:55:20 UTC
Great, thanks....I did find and replace the identifying
info....replaced names and institution, so those are the two types of
XXXX's in your quote. =C2=A0There are a few different types of accounts in
our exchange server - one is a livemail anbd another is exchange.
=C2=A0Livemail addresses have the livemail.XXXXX.edu and exchange addresses
are just XXXXX.edu. =C2=A0I never see the exchange.XXXXX.edu variant. =C2=
=A0

I use Arch, so hopefully it will hit the repos sometime next week.

I want to make sure you are also stripping the sip: prefix that is also
sometimes returned in front of email addresses. =C2=A0I have no idea why
some are prepended with smtp: and some with sip: =C2=A0none of these should
be sip addresses as they are all just corporate exchange email
accounts.
Comment 7 Milan Crha 2016-05-04 07:22:33 UTC
The old code ignored everything but the email addresses with the SMTP: prefix. My initial change changed the behaviour a bit and allowed other prefixes too. The final fix returned back the previous behaviour, thus anything what doesn't have prefix "SMTP:" (case insensitive this time) is ignored in the email address. There's always a fallback for the MailBox email, in case none of the Contact addresses are acceptable.

I also thought of adding the MailBox email if it doesn't match any of the Contact addresses, but that's the question, whether it would make sense. In the case above you'd end up with the contact with two email addresses filled, one being XXXXXX@exchange.XXXXXX.edu and another being XXXXXX@XXXXXX.edu, in this order of preference.
Comment 8 Brett 2016-05-04 14:39:39 UTC
That doesn't sound ideal.  The way it was working prior to v3.20 was always just fine, I never actually had a situation where I needed the alternative address.  For me populating with both addresses is a worse case because the preference order is reversed (in my case at least).  I only every use the XXX@XXXX.edu.  I am not even sure if the XXX@exchange.XXX.edu email is valid and will transmit, as I have never sent an email with that format to an address in the Global contact list.
Comment 9 Milan Crha 2016-05-05 07:34:00 UTC
Right. I thought either of changing the order or ignore emails from the Contact section completely, though I can imagine it'll not always work for other users (for users where the GAL contains alternative addresses for the Mailbox).

By the way, if the XXX@exchange.XXX.edu doesn't work, then your admins should configure the server to not advertise it.
Comment 10 Milan Crha 2016-05-05 09:32:39 UTC
I managed to create a MailContact on my Exchange server (it was a challenge) which currently returns:

   <t:Mailbox>
      <t:Name>Multi Email</t:Name>
      <t:EmailAddress>multi-email-a1@no.where</t:EmailAddress>
      <t:RoutingType>SMTP</t:RoutingType>
      <t:MailboxType>Contact</t:MailboxType>
   </t:Mailbox>
   <t:Contact>
      <t:DisplayName>Multi Email</t:DisplayName>
      <t:EmailAddresses>
        <t:Entry Key="EmailAddress1">SIP:multi-email-sip@no.where</t:Entry>
        <t:Entry Key="EmailAddress2">smtp:multi-email-a2@no.where</t:Entry>
        <t:Entry Key="EmailAddress3">SMTP:multi-email-a1@no.where</t:Entry>
      </t:EmailAddresses>
      ...
   </t:Contact>

It's not exactly what you see, but it's close. The result in the evolution with the patched evolution-ews is that the contact has three addresses, those from EmailAddresses, including the SIP address, with the "SIP:" prefix.

I'll update the fix to work on this properly, in a way that Mailbox/EmailAddress will be always the primary (first) email and the other emails being added from the Contact/EmailAddresses element will be only SMTP addresses and unique addresses (for me, EmailAddress3 matches the one at Mailbox, thus to not duplicate it). This way the old behaviour will be preserved with the addition of the other addresses, if available.
Comment 11 Milan Crha 2016-05-05 09:59:01 UTC
Use the Mailbox address as the main email address and merge it with
the email addresses from the Contact element.

Created commit d3d8099 in ews master (3.21.1+)
Created commit 980083c in ews gnome-3-20 (3.20.2+)
Comment 12 Milan Crha 2016-05-05 10:00:57 UTC
(In reply to Milan Crha from comment #11)
> Created commit d3d8099 in ews master (3.21.1+)

err, it was supposed to be 3.21.2+
Comment 13 Brett 2016-05-05 14:29:31 UTC
I don't know if the Exchange.XXXX.edu address works or not.  I have never used it and our IT folks have never mentioned this format to us.  The only reason I even know about it is the log I posted above!  There are some users with livemail.XXX.edu addressess (these are student addresses, so they are used for more temporary accounts, AFAIK), and for those, I do include the livemail.XXX.edu format.

Thanks again, looking forward to this hitting my repos.