디렉토리 API Java 용 Google API를 사용하여 다른 조직 단위로 조직 단위 이동

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

  •  20-12-2019
  •  | 
  •  

문제

하나의 부모 아래에서 다른 부모에서 다른 부모로부터 다른 부모 단위로 이동하는 것을 테스트하고 있습니다.지금 당장 나는 다음과 같은 oul을 가지고있다 :

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 만 업데이트하면됩니다.따라서 위의 코드는 다음과 같습니다.

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