![](/img/trans.png)
[英]Get Groups From OU using DirectoryServices.AccountManagement
[英]accessing the initials field using the DirectoryServices.AccountManagement
我是新手訪問Active Directory,我被建議使用System.DirectoryServices.AccountManagement
但我找不到任何幫助的initials
變量?
你可以做其中一件事:
1)您可以擴展正常的UserPrincipal
類以包含您經常需要的其他項目。 這確實是最干凈的解決方案。 有關如何使用其他屬性擴展UserPrincipal
類的示例,請參閱有關擴展用戶主體的MSDN文檔 ,或回答此SO問題 。
2)您可以“深入”到底層DirectoryEntry
的深處並從那里獲取數據:
DirectoryEntry de = YourUserPrincipal.GetUnderlyingObject() as DirectoryEntry;
if(de != null)
{
var initials = de.Properties["initials"];
if(initials != null && initials.Count > 0)
{
string theInitials = de.Properties["initials"][0].ToString();
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.