Hi.
I'm trying to add new object to existing organisational unit in Active Directory. Following code is used to do this.
It runs without errors. But new object is not created after this. Please advise what I'm doing wrong here.
using System.DirectoryServices;
using System.DirectoryServices.ActiveDirectory;
namespace TestAdObjectCreation
{
class Program
{
static void Main(string[] args)
{
DirectoryEntry root = new DirectoryEntry("LDAP://servername/OU=Services,OU=PCX,DC=q2q,DC=xenyq,DC=com", "Administrator", "pass");
DirectoryEntry newItem = root.Children.Add("test_node", "valid_schema_class_name");
root.CommitChanges();
root.Close();
root.Dispose();
}
}
}