如何提取Outlook显示的相同employeeID属性值?

 果子露强逼_604 发布于 2023-02-12 02:35

我们公司出于各种原因使用ActiveDirectory.其中之一是处理Outlook联系人和用户登录ID.

我编写了一个程序来检测登录的用户ID,并使用提取的登录ID搜索Active Directory.然后,从Active Directory中提取的信息将存储在数据库中.

这是我用来提取ActiveDirectory信息数据的代码:

Dim enTry As DirectoryEntry = _
     New DirectoryEntry("LDAP://myCOMPANY/DC=myCOMPANY,DC=myCOMPANY,DC=com")

Dim mySearcher As DirectorySearcher = New DirectorySearcher(enTry)
mySearcher.Filter = "(&(objectClass=user)(anr=" & thisUser & "))" 
'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: " & ex.Message)
End Try

出于某种原因,某些用户的employeeID字段没有值,有些用户也没有.

但是,所有用户在Outlook中浏览时都会显示employeeID值.

我设计了以下图片,以帮助您了解我正在经历的事情.图像分为两个部分,每个部分都有一个部分.

================================================== ======

在案例1中,员工使用他的ID登录到Windows:xms33808

Outlook显示他的员工ID是 16078

Outlook显示他的电子邮件别名是 xms33808

ASP.Net命令窗口显示他的employeeID是xms33808,这不是真的

================================================== ====

================================================== =====

在案例2中,员工使用ID登录Windows:25163

Outlook显示他的员工ID是 25163

Outlook显示他的电子邮件别名是 MutawaAAB

ASP.Net命令窗口显示他的employeeID是NOTHING.

================================================== =====

我的问题是:如何提取Outlook显示的相同employeeID值信息?

案例1:employeeID与ASP.Net不同于Outlook 案例2:在Outlook中找到employeeID,但ASP.Net中没有

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有