Suppose there is a user zhangsan located at LADP://192.168.213.168/CN=zhangsan,CN=Users,DC=pk1,DC=cctv,DC=com. Now we want to add this user to LADP:// In the user group 192.168.213.168/CN=PG_GROUP,OU=ORG_PGM,DC=pk1,DC=cctv,DC=com, the
code is as follows:
C# code
String groupPath = "LADP://192.168.213.168/CN=zhangsan,CN=Users,DC=pk1,DC=cctv,DC=com"; DirectoryEntry group = new DirectoryEntry(groupPath ); String userPath = "CN=zhangsan,CN=Users,DC=pk1,DC=cctv,DC=com"; group.Properties["member"].Add(userPath ); group.CommitChanges();