Directory API Google API for Javaを使用している組織単位を別の組織単位に移動する

StackOverflow https://stackoverflow.com//questions/22000653

  •  20-12-2019
  •  | 
  •  

質問

組織単位を1つの親の下から別の親に移動させています。今私は次のousを持っています:

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

例えば小学校OUにグレード07を動きたい。これが私のコードスニペットです:

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を更新するだけで済みます。そのため、上記のコードはIKEこれに見えます:

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top