Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I extract the same employeeID attribute value that Outlook is displaying?
    text
    copied!<p>Our company uses ActiveDirectory for various reasons. One of them is to handle Outlook contacts and user log-in IDs.</p> <p>I have written a program to detect the logged in user id, and to search the Active Directory using the extracted login id. The pulled information from the Active Directory is then stored in a database.</p> <p>Here is the code I used to pull ActiveDirectory information data:</p> <pre><code>Dim enTry As DirectoryEntry = _ New DirectoryEntry("LDAP://myCOMPANY/DC=myCOMPANY,DC=myCOMPANY,DC=com") Dim mySearcher As DirectorySearcher = New DirectorySearcher(enTry) mySearcher.Filter = "(&amp;(objectClass=user)(anr=" &amp; thisUser &amp; "))" 'thisUser is the variable holding the Windows ID that is accessing the ASPX page mySearcher.PropertiesToLoad.Add("employeeID") 'just in case I need to do this. Dim resEnt As SearchResult Try For Each resEnt In mySearcher.FindAll() Dim fullname As String = resEnt.GetDirectoryEntry.Properties.Item("cn").Value 'fullname will always pull the right information Dim e_id As String = resEnt.GetDirectoryEntry.Properties.Item("employeeID").Value 'e_id will sometimes be NOTHING, sometimes will contain an ID that ' is different from the one displayed in Outlook Contact Information ' and sometimes it will be matching the employeeID listed in Outlook info Catch ex as Exception Log("Failed to pull AD data: " &amp; ex.Message) End Try </code></pre> <p>For some reason, some users have no values for their employeeID field, and some have.</p> <p>However, all of the users, will display an employeeID value when browsed in Outlook.</p> <p>I designed the following image to help you understand what I am going through. The image is divided into two sections, a section for each CASE.</p> <p>========================================================</p> <p><strong>In Case 1</strong>, the employee has logged in to Windows using his ID: <code>xms33808</code></p> <p>Outlook shows that his Employee ID is <code>16078</code></p> <p>Outlook shows that his email alias is <code>xms33808</code></p> <p>ASP.Net command window shows that his employeeID is <code>xms33808</code>, which is not true</p> <p>======================================================</p> <p>=======================================================</p> <p><strong>In Case 2</strong>, the employee has logged in to Windows using ID: <code>25163</code></p> <p>Outlook shows that his Employee ID is <code>25163</code></p> <p>Outlook shows that his email alias is <code>MutawaAAB</code> </p> <p>ASP.Net command windows shows that his employeeID is <code>NOTHING</code>.</p> <p>=======================================================</p> <p>My question is : How can I extract the same employeeID value information that Outlook is displaying?</p> <p><img src="https://i.stack.imgur.com/cOg0b.png" alt="Case 1: employeeID is different from ASP.Net than Outlook"> <img src="https://i.stack.imgur.com/rN5q3.png" alt="Case 2: employeeID is found in Outlook, but Nothing in ASP.Net"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload