This documentation is archived and is not being maintained.
DirectorySynchronization Class
Visual Studio 2008
Specifies how to synchronize a directory within a domain.
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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: