OpenLDAP and .NET
-
I am having a weird problem adding new objects to the directory server. I am logged in using the Manager account, so I have r/w access to everything. Here's how I add an object: DirectoryEntry de = configuration.Bind(); // <- this works fine, I can read everything. DirectoryEntry newEntry = de.Children.Add("cn=John Doe", "inetOrgPerson"); newEntry.Properties["sn"].Value = "Doe"; newEntry.Properties["givenName"].Value = "John"; newEntry.CommitChanges(); // <- this is where the exception is thrown. System.Runtime.InteropServices.COMException (0x80072037): There is a naming violation. at System.DirectoryServices.Interop.IAds.SetInfo() at System.DirectoryServices.DirectoryEntry.CommitChanges() at HMSImport.MainForm.menuItem3_Click(Object sender, EventArgs e) in c:\documents and settings\jd\my documents\visual studio projects\hmsimport\mainform.cs:line 255 Does anyone have a clue as what it could be? I am running openldap-2.2.9 as the directory server.
-
I am having a weird problem adding new objects to the directory server. I am logged in using the Manager account, so I have r/w access to everything. Here's how I add an object: DirectoryEntry de = configuration.Bind(); // <- this works fine, I can read everything. DirectoryEntry newEntry = de.Children.Add("cn=John Doe", "inetOrgPerson"); newEntry.Properties["sn"].Value = "Doe"; newEntry.Properties["givenName"].Value = "John"; newEntry.CommitChanges(); // <- this is where the exception is thrown. System.Runtime.InteropServices.COMException (0x80072037): There is a naming violation. at System.DirectoryServices.Interop.IAds.SetInfo() at System.DirectoryServices.DirectoryEntry.CommitChanges() at HMSImport.MainForm.menuItem3_Click(Object sender, EventArgs e) in c:\documents and settings\jd\my documents\visual studio projects\hmsimport\mainform.cs:line 255 Does anyone have a clue as what it could be? I am running openldap-2.2.9 as the directory server.
Hi Jan, I dont think you should do like this: newEntry.Properties["sn"].Value = "Doe"; newEntry.Properties["givenName"].Value = "John"; rather use Add instead of Value this it should work newEntry.Properties["sn"].Add = "Doe"; newEntry.Properties["givenName"].Add = "John"; I hope it helps Osama Mirza