我正在测试将一个组织单位从一个父母移到另一个父母。现在我有以下OU:
YourDomain.com
-Middle Schools
--Grade07
-Elementary Schools
--Grade01
--Garde02
我想将07年级升到小学OU。这是我的代码片段:
List<String> list = new ArrayList<String>();
list.add("Middle Schools");
list.add("Grade 07");
OrgUnit ou = sDirectory.orgunits().get("my_customer", list).execute();
ou.setParentOrgUnitPath("/Elementary Schools");
ou.setOrgUnitPath("/Elementary Schools/Grade 07");
list.clear();
list.add("Elementary Schools");
list.add("Grade 07");
sDirectory.orgunits().update("my_customer", list, ou).execute();
我一直收到以下错误:
404 Not Found
{
"code" : 404,
"errors" : [ {
"domain" : "global",
"message" : "Org unit not found",
"reason" : "notFound"
} ],
"message" : "Org unit not found"
}
我错过了什么?
答案 0 :(得分:0)
我尝试了这个并且它有效。我意识到你只需要更新parentOrgUnitPath。所以上面的代码看起来像这样:
List<String> list = new ArrayList<String>();
list.add("Middle Schools");
list.add("Grade 07");
OrgUnit ou = sDirectory.orgunits().get("my_customer", list).execute();
ou.setParentOrgUnitPath("/Elementary Schools");
sDirectory.orgunits().update("my_customer", list, ou).execute();