我有一封来自Google Apps域名的电子邮件。我可以通过进入谷歌应用程序的联系人页面,在“域”下看到一个域中所有用户的列表。
如果我想从那封电子邮件中得到他们的全名,我该怎么做呢?我试过使用ContactsApp,但都没有用。我也不能在域工具中使用UserManager,因为我没有访问管理工具的权限。
你知道我该怎么做吗?
发布于 2013-04-17 10:01:10
您的问题类似于Google Script How do I getGivenName() of getActiveUser(),尽管在这种情况下,管理员试图创建一个服务,域成员运行的脚本可以使用该服务来获取自己的全名。
this answer可能会有所帮助。作为域用户,您可以获取自己联系人列表中人员的全名。加入足够多的人(或合适的人),你的成功率将会很高。
以下是该脚本的修改版本。
/**
* Get a user's name, by accessing contacts.
*
* @returns {String} FullName, or UserID
* if record not found in contacts.
*/
function getUserName(email){
var user = ContactsApp.getContact(email);
// If user in contacts, return their name
if (user) {
// Get full name
var name = user.getFullName();
}
if (!name) {
// If not in Contacts, return the bald userID.
name = email.split('@')[0];
}
return name;
}发布于 2013-05-09 21:30:19
要求管理员授予您自己对用户配置API的只读访问权限。这一点和GAL提要在这个问题的答案中都有介绍:How can I get read-only access to the Google Apps Profiles API?
https://stackoverflow.com/questions/16008421
复制相似问题