Hello
I am working with AD and i have to add users to the distribution list if they are not present in the distribution list . Everything works fine, but sometimes i get the exception as "A device attached to the system is not functioning." at directoryentry.commitchanges() method. and sometimes it successfully adds the user to the distribution list. I checked all the user-names and there is no special characters in the user-name i wonder is this exception is due to any network related issues. And more importantly the exception is not consistent, for example if i get the exception when adding 10 users to a distribution list and when i tried next time with the same 10 users the list updates successfully with the added users. I really don't understand why i am getting this exception. Any help really appreciated. Here is the block of code i am using.
entry = new directoryentry(LDAP+DL path,username,pwd,authenticationtype.secure)
i gave all the filters and properties to load conditions and finally
child = results[0].getdirectoryentry()
i can access all the properties of the DL with child
if(!child.properties["member"].contains("CN=username,ou=something,ou=something," +
"dc=something,dc=com"))
child.properties["member"].add("CN=username,ou=something,ou=something,dc=something,dc=com")
try{
child.commitchanges();
}
catch(exp ex)
{
writelogfile(ex);
}
Thanks in advance.
[Modified: added pre tags]