使用Admin Directory API应用脚本创建用户

时间:2018-10-22 08:35:01

标签: google-apps-script gsuite google-directory-api

我正在尝试通过Google Forms通过App Script创建用户,该帐户将在GSuite中进行设置。运行脚本时,将创建帐户,但用户帐户详细信息中不包括员工和组织的详细信息。

import os

from celery import Celery
from celery.schedules import crontab
from django.conf import settings

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")

app = Celery('biko')

app.config_from_object('django.conf:settings')

app.autodiscover_tasks()
app.conf.ONCE = {
  'backend': 'celery_once.backends.Redis',
  'settings': {
    'url': 'redis://redis',
    'blocking': True,
    'default_timeout': 60 * 60,
    'blocking_timeout': 86400
  }
}

1 个答案:

答案 0 :(得分:0)

我再次通过添加[]进行了测试,并且可以正常工作。

var user = {
  primaryEmail: preferredEmail,
  name: {
     givenName: firstName,
     familyName: lastName,
     fullName: firstName + ' ' + lastName,
     },
  relations: [{
     value: reportingManager,
     type: 'manager',
    }],
  organizations: [{
     title: designation,
     primary: true,
     department: dept,
     description: employmentType,
     costCenter: location,
    }],

  password: password,
  changePasswordAtNextLogin: 'true',