查询主体对象的属性
本文关键字:属性 对象 主体 查询 | 更新日期: 2023-09-27 18:18:21
我希望能够查询Active Directory中用户对象的所有可能的Active Directory属性(所有AD用户属性列表)。目前,我正在为属性做以下操作,例如:lastLogon
:
(主体为Principal
对象)
DirectoryEntry directoryEntry = principal.GetUnderlyingObject() as DirectoryEntry;
if (directoryEntry.Properties.Contains("lastLogon"))
{
return directoryEntry.Properties["lastLogon"].Value.ToString();
}
但是这给了我System.__ComObject
作为值,因为directoryEntry
是空的。
我的问题是:如何从Principal对象获得lastLogon
(或所有其他User属性)属性?
我使用了一个适用于lastLogon的扩展类:
http://www.codeproject.com/Articles/565593/How-to-get-the-REAL-lastlogon-datetime-from-Active