Bagikan melalui


AdvancedFilters.AccountExpirationDate(DateTime, MatchType) Metode

Definisi

Mengatur filter kueri untuk AccountExpirationDate atribut ke waktu dan jenis perbandingan yang ditentukan.

public:
 void AccountExpirationDate(DateTime expirationTime, System::DirectoryServices::AccountManagement::MatchType match);
public void AccountExpirationDate (DateTime expirationTime, System.DirectoryServices.AccountManagement.MatchType match);
member this.AccountExpirationDate : DateTime * System.DirectoryServices.AccountManagement.MatchType -> unit
Public Sub AccountExpirationDate (expirationTime As DateTime, match As MatchType)

Parameter

expirationTime
DateTime

Objek DateTime.

match
MatchType

MatchType yang menentukan bagaimana expirationTime harus digunakan dalam perbandingan.

Contoh

// Create the principal context for the usr object.  
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "fabrikam.com", "CN=Users,DC=fabrikam,DC=com", "administrator", "SecurelyStoredPassword");  

// Create the principal user object from the context  
UserPrincipal usr = new UserPrincipal(ctx);  

// Set the advanced query filter  
usr.AdvancedSearchFilter.AccountExpirationDate(DateTime.Now, MatchType.LessThan);  

// Create a PrincipalSearcher object.  
PrincipalSearcher ps = new PrincipalSearcher(usr);  

PrincipalSearchResult<Principal> results = ps.FindAll();  

Console.WriteLine("The following users' accounts have expired:");  

foreach (UserPrincipal u in results)  
{  
  Console.WriteLine(u.Name);  
}  

Keterangan

Waktu akan default ke UTC. Jika Anda ingin menentukan waktu dalam waktu setempat, tentukan Kind properti objek Anda DateTime sebagai DateTimeKind.Local.

Berlaku untuk

Lihat juga