朋友们
我是我的域的管理员,我很难使用配置 api 收集帐户的所有属性,如下所示。
function myFunction() {
var base = "https://apps-apis.google.com/a/feeds/";
var fetchArgs = googleOAuth_("provisioning", base);
var url = base + "domain" + "/user/2.0";
var result = UrlFetchApp.fetch(url,fetchArgs).getContentText()
var xml = Xml.parse(result);
//Logger.log(result)
var users = xml.feed.entry;
var r = [['Usuário', 'Nome Completo', 'Permissão Administrador', 'Cota', 'Conta Bloqueada']];
for( var i in users )
r.push([users[i].login.userName,
users[i].name.givenName+' '+users[i].name.familyName,
users[i].login.admin,
users[i].quota.limit,
users[i].login.suspended]);
var s = SpreadsheetApp.getActiveSheet();
s.clearContents();
s.getRange(1, 1, r.length, r[0].length).setValues(r);
}
function googleOAuth_(name,scope) {
var oAuthConfig = UrlFetchApp.addOAuthService(name);
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oAuthConfig.setConsumerKey("anonymous");
oAuthConfig.setConsumerSecret("anonymous");
return {oAuthServiceName:name, oAuthUseToken:"always"};
}
有谁知道告诉帐户属性,使用的示例配额,暂停帐户的日期。