Skip to content

Instantly share code, notes, and snippets.

@codewithtyler
Created December 31, 2016 03:02
Show Gist options
  • Select an option

  • Save codewithtyler/ca3e7dac251c28f420cd247649c5041c to your computer and use it in GitHub Desktop.

Select an option

Save codewithtyler/ca3e7dac251c28f420cd247649c5041c to your computer and use it in GitHub Desktop.
private string _distinguishedName = "OU=test,DC=cwn,DC=org";
DirectoryManagement manager = new DirectoryManager( _distinguishedName );
List<Container> containers = manager.Children;
List<Group> groups = containers.Children;
// Add a new container
Container _container = new Container();
manager.Add( _container );
// Add a new group to a specific container
Group _group = new Group();
Container _testContainer = containers.Children.Find( "test" );
_testContainer.Add( _group );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment