这是我的代码:
public String addPerson(String userID, String surName, String givenName,String
password,String email){
//create user state
String state = "0";
String userName;
String userPrincipalName;
userName = String.format("%s%s", surName, givenName);
userPrincipalName = String.format("%s@%s", userID, domainName);
Attribute objectClass = new BasicAttribute("objectClass");
objectClass.add("top");
objectClass.add("person");
objectClass.add("organizationalPerson");
objectClass.add("user");
Attributes attributes = new BasicAttributes();
attributes.put(objectClass);
attributes.put(new BasicAttribute("sn",surName));
attributes.put(new BasicAttribute("cn",userID));
attributes.put(new BasicAttribute("displayName",userName));
attributes.put(new BasicAttribute("givenName",givenName));
attributes.put(new BasicAttribute("mail",email));
attributes.put(new BasicAttribute("description",userName));
attributes.put(new BasicAttribute("userPassword",password));
attributes.put(new BasicAttribute("userPrincipalName", userPrincipalName));
attributes.put(new BasicAttribute("sAMAccountName", userID));
attributes.put(new BasicAttribute("msRTCSIP-InternetAccessEnabled", true));
attributes.put(new BasicAttribute("userAccountControl", 65536));
try
{
currentContextName = "CN=" + userID + "," + currentContextName;
System.out.println("addPerson-currentContextName:" + currentContextName);
currentCtx = ctx.createSubcontext(currentContextName, attributes);
}
catch (NamingException e)
{
state = "-1";
e.printStackTrace();
}
return state;
}
属性“ msRTCSIP-InternetAccessEnabled
”和“ userAccountControl
”不起作用,我该如何解决?