DirectorySynchronization Class
.NET Framework 2.0
Specifies how to synchronize a directory within a domain.
Namespace: System.DirectoryServices
Assembly: System.DirectoryServices (in system.directoryservices.dll)
Assembly: System.DirectoryServices (in system.directoryservices.dll)
The following C# example shows how to synchronize a directory.
DirectorySearcher src = new DirectorySearcher("…"); src.DirectorySynchornization= new DirectorySynchronization(); // Initiate dirsync, // this means a full synch foreach(SearchResult res in src.FindAll() ) { Console.WriteLine(…"); } // Restart the dirsync foreach(SearchResult res in src.FindAll() ) { Console.WriteLine(…"); }
The following C# example shows how to synchronize a directory by persisting it to a file.
DirectorySearcher src = new DirectorySearcher("…"); src.DirectorySynchornization= new DirectorySynchronization(); // Initiate dirsync, // this means a full synch foreach(SearchResult res in src.FindAll() ) { Console.WriteLine(…"); } // Now they should be able to persist the dirSync cookie, by serializing to a file. FileStream myStream = File.Create("dirsync.data"); BinaryFormatter fmt = new BinaryFormatter(); fmt.Serialize(myStream, src.DirectorySynchronization); myStream.Close(); … …. // At some point in time, we wake up and read by de-serializing the dirSync cookie, // and resume the dirSync FileStream myStream = FileCreate("dirsync.data"); BinaryFormatter fmt = new BinaryFormatter(); DirectorySynchronization dirSync = fmt.Deserialize(myStream); DirectorySearcher src = new DirectorySearcher(…); src.DirectorySynchronization = dirSync; foreach(SearchResult res in src.FindAll() ) { Console.WriteLine(…"); }
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.Community Additions
ADD
Show: