问题描述
/***添加代码*/publicvoidadd(StringnewUserName){try{BasicAttributesattrs=newBasicAttributes();BasicAttributeobjclassSet=newBasicAttribute("objectClass");objclassSet.add("sAMAccountName");objclassSet.add("employeeID");attrs.put(objclassSet);attrs.put("ou",newUserName);attrs.put("cn","testcn");attrs.put("sn","testsn");dc.createSubcontext("ou="+newUserName+","+root,attrs);}catch(Exceptione){e.printStackTrace();System.out.println("Exceptioninadd():"+e);}}
解决方案
时间: 2024-12-27 15:32:54