直接上代码:
//departmentFullName 公司>一级部门>二级部门>新建的OU部门
public boolean addOrganizationUnit(String departmentFullName) {
DirContext ctx = null;
Properties env = null;
try {
env = initAdminSSLEnv();
ctx = new InitialDirContext(env);
String newUserName = departmentFullName.substring(departmentFullName.lastIndexOf(">") + 1);
BasicAttributes basicAttributes =