Hi all
I'm new to LDAP, but have managed to query the Active Directory db on a Windows 2003 domain.
However, whenever I try to modify any data I get an object class violation. I've trawled the web and have yet to work out why. Can anyone here help ?
Code:

$ldapbind = ldap_bind($connect, $ldap_user, $ldap_pass);

	if ($ldapbind) 
	{
	echo "LDAP bind successful...";
	$read = ldap_search($connect, $base_dn, $filter);
	$info = ldap_get_entries($connect, $read);
	echo $info["count"]." entries returned<br>";

		for ($i=0; $i<$info["count"]; $i++)
		{

		echo "Display name is: ". $info[$i]["displayname"][0];
		$newinfo1 = $info[$i]["displayname"];
		echo "<br>";
		echo "Email is: ". $info[$i]["mail"][0];
		print($i);
		echo "<br>";
		echo "Telephone number is: ". $info[$i]["telephonenumber"][0];
		echo "<br>";
		echo "Description is: ". $info[$i]["description"][0];
		echo "<br>";
		echo "Location is: ". $info[$i]["l"][0];
		echo "<br>";
		echo "Address is: ". $info[$i]["streetaddress"][0]." ".$info[$i]["postalcode"][0]." ".$info[$i]["l"][0]." ".$info[$i]["st"][0];
		echo "<br>";
		echo "Department is: ". $info[$i]["department"][0];
}
		$newinfo["mail"]="test@test.com";
                        $tryit = ldap_modify($connect, $base_dn, $newinfo);
	ldap_close($connect);
	}

The error is always: Warning: ldap_modify(): Modify: Object class violation in E:\Work\J\www\ldap_new.php on line 82

Any help gratefully received.
Thanks
J

    10 years later

    I am having the same problem,

    Do you solutions to it.

      Write a Reply...