110,477
社区成员
发帖
与我相关
我的任务
分享
public List<UserPrincipal> GetUsersByExpiryDate(DateTime dtExpiryDate, MatchType enumMatchType = MatchType.LessThan)
{
List<UserPrincipal> userList = new List<UserPrincipal>();
using (UserPrincipal oUserPrincipal = new UserPrincipal(myPrincipalContext))
{
oUserPrincipal.AdvancedSearchFilter.AccountExpirationDate(dtExpiryDate, enumMatchType);
using (PrincipalSearcher oPrincipalSearcher = new PrincipalSearcher(oUserPrincipal))
{
using (PrincipalSearchResult<Principal> results = oPrincipalSearcher.FindAll())
{
foreach (UserPrincipal u in results)
{
userList.Add(u);
}
}
}
}
return userList;
}
一样遇到坑,不知道咋搞