2012-05-23 15 views
3

我正在更新與我們的應用程序中的AD交互的代碼。當前的代碼使用ActiveDs接口。我正在更改代碼以使用System.DirectoryServices.AccountManagement命名空間。我們的應用程序允許用戶存儲密碼提示。這存儲在用戶定義的參數下的AD中。我知道我可以用DirectoryEntry.Invoke("put")方法做到這一點。一個等同於DirectoryEntry.Invoke的UserPrincipal?

是否有無論如何與UserPrincipal做到這一點,還是我需要調用GetUnderlyingObject方法,然後調用DirectoryEntry.Invoke("put")

任何意見/建議,將不勝感激。

回答

4

UserPrincipal類是可擴展的,因此您可以在您的用戶主體上「表示」更多底層DirectoryEntry對象的屬性。

使用可擴展的技術,它是在MSDN文章Managing Directory Security Principals in the .NET Framework 3.5中解釋,你應該能夠也使提供的自定義屬性(我假設你是怎麼存儲密碼提示DirectoryEntry)上擴展UserPrincipal類。

+0

太棒了!謝謝。 –