Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

C#
entry = new directoryentry(LDAP+DL path,username,pwd,authenticationtype.secure)


i gave all the filters and properties to load conditions and finally

C#
child = results[0].getdirectoryentry()


i can access all the properties of the DL with child

C#
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]
Posted
Updated 31-Mar-10 9:33am
v3

1 solution

Did you get solution on this ?

I am facing the same issue , if you found any solution then please let me know.

Thanks in Advance,
Sachin Jagtap
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900