title: Delphi - Find primary email address for an Active Directory user
body: <p>I'm looking for the best* method to find the primary email address for the currently logged in Active Directory user (using <code>GetUserName</code> to get the logged in username)</p>
  
  <p>I have seen <a href="https://stackoverflow.com/questions/337300/">How do integrate Delphi with Active Directory?</a> but I couldn't get this to work with Delphi 2010.</p>
  
  <p>(*best method: the eventual application will be run by users who do not have administrative access to the machine)</p>
  
  <hr>
  
  <p>Edit 1:</p>
  
  <p>Reading up on this, it appears that the <code>email</code> or <code>mail</code> field is probably not the best way to go as it seems it might not be populated, therefore I'd need to use the multivalue field of <code>proxyaddresses</code></p>