I am trying to create an org unit in the Google Admin Console, but it seems to ask for two arguments and I cannot find what to put in the second, unless it is to add a user, and then I have no idea how to create the org unit. What I have is this:
function createOrg() {
var resource = {
name: "TEST",
description: "The test",
parentOrgUnitPath: "/",
blockInheritance: false
}
var org = AdminDirectory.Domains.insert(resource, ?????);
}
UPDATE
First I had to follow this link here to get the "Customer" which is really the ID of the admin user I suppose. Then another error came out which was "Missing required field: domainName", So I tried adding that, but again, another error which was "Invalid Value", so I still don't know what is wrong. Now the script is:
function createOrg() {
var resource = {
domainName: "TEST",
name: "TEST",
description: "The is a test",
parentOrgUnitPath: "/",
blockInheritance: false
}
var customer = 'USERID';
var org = AdminDirectory.Domains.insert(resource,customer);
}
UPDATE
As was mentioned below, the only thing that had to be changed was Orgunits instead of Domains:
var org = AdminDirectory.Orgunits.insert(resource,customer);