本文介绍了Directory API将使用Google api for Java的组织单位移动到另一个组织单位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试将组织单位从一位家长下移到另一位.现在,我有以下OU:

I am testing moving an organization unit from under one parent to another. Right now i have a following OUs:

YourDomain.com
-Middle Schools
--Grade07
-Elementary Schools
--Grade01
--Garde02

例如,我想将07年级转移到小学OU.这是我的代码段:

I want to move Grade 07 to Elementary School OU for example. Here is my code snippet:

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"
}

我想念什么?

推荐答案

我尝试了此方法,并成功了.我知道您只需要更新parentOrgUnitPath.所以上面的代码看起来像这样:

I tried this and it worked. I realize you only need to update the parentOrgUnitPath. So the above code looks ike this:

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(); 

这篇关于Directory API将使用Google api for Java的组织单位移动到另一个组织单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 17:03