원래 ActiveDirectoryServices
을 사용했지만 다른 멤버의 제안에 따라 ActiveDirectoryServices.AccountManagment
기반으로 전환했습니다. 함께 작업하는 것이 훨씬 쉬우나 한 가지 도전 과제를 제시합니다. LastPasswordSet
을 반환하면 현지 시간 대신 UTC가 사용됩니다. 이 문제를 어떻게 해결할 수 있습니까?ActiveDirectoryServices.AccountManagment - LastPasswordSet - UTC time
감사합니다,
제이슨
public UserPrincipal GetUser(string sUserName)
{
PrincipalContext oPrincipalContext = GetPrincipalContext();
UserPrincipal oUserPrincipal =
UserPrincipal.FindByIdentity(oPrincipalContext, sUserName);
if (oUserPrincipal != null)
{
BuildUser(oUserPrincipal);
}
return oUserPrincipal;
}
private void BuildUser(UserPrincipal user)
{
//Populate the user with items available in the UserPrincipal object
if (user != null)
{
if (user.LastPasswordSet.HasValue)
this.PasswordLastSet = (DateTime)user.LastPasswordSet;
}
}