Directory API Mover una unidad de organización con Google API para Java a otra unidad de organización

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

  •  20-12-2019
  •  | 
  •  

Pregunta

Estoy probando moviendo una unidad de organización de debajo de un padre a otro.En este momento tengo un siguiente OUS:

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

Quiero mover el grado 07 a la escuela primaria, por ejemplo.Aquí está mi código 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(); 

Sigo obteniendo el siguiente error:

404 Not Found
{
  "code" : 404,
  "errors" : [ {
    "domain" : "global",
    "message" : "Org unit not found",
    "reason" : "notFound"
  } ],
  "message" : "Org unit not found"
}

¿Qué extraño?

¿Fue útil?

Solución

Intenté esto y funcionó.Me doy cuenta de que solo necesitas actualizar el Parentorgunitpath.Así que el código anterior se ve ike esto:

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top