GAS,更新用户信息:AdminSDK目录服务

时间:2015-09-14 14:35:47

标签: google-apps-script

我对GAS很新。我试图了解AdminDirectory Service如何更新用户信息。 https://developers.google.com/admin-sdk/directory/v1/reference/users

这是我的代码,出了什么问题?

function updateUserInfos (){
  var opt = phones{
   type : "work",
   value : "999999",
   primary : true
  };
  var updates = AdminDirectory.Users.update(opt, "user@domain.com")
}

非常感谢

1 个答案:

答案 0 :(得分:0)

Try

function updateUserInfos (){
  var opt = {"phones":[{
     "type" : "work",
     "value" : "999999",
     primary : true
    }]
  };
  var updates = AdminDirectory.Users.update(opt, "user@domain.com")
}

if multiple phones

var opt = {"phones":[{"type" : "work",
     "value" : "999999",
     primary : true}],
    [{"type" : "mobile",
     "value" : "88888" }]
  };

Stéphane