2013-05-19 56 views
0

我試圖找到某種方式在用戶登錄到他的Google帳戶後,從Google網站中的Google應用程序腳本小工具的控制面板中檢索信息。在Google應用程序腳本中顯示帳戶信息

我找到了run the script as the user的一種方法,並使用函數Session.getActiveUser()並將其部署到apps腳本小工具中。

沒有工作,出現錯誤「腳本完美運行,但沒有任何回報。」

此問題的任何解決方案?或者我錯過了其他一些顯示所需信息的好方法嗎?

+0

你可以發佈一些代碼。看看這個問題,看起來你有一個doGet(),但沒有從doGet中返回一個UiApp。 – Srik

+0

'function doGet(e){ var value = logActiveUserEmail(); 返回值; } function logActiveUserEmail(){ var email = Session.getActiveUser()。getEmail(); Logger.log(email); } ' 你去那裏 –

回答

1

正如我在我的評論中提到的,你沒有返回一個UiApp對象。有關如何顯示UI的信息,請參閱Ui Service documentation。在一個非常基本的水平,你可以使用下面的代碼

function doGet(e) 
{ 
var app = UiApp.createApplication(); 
var value = logActiveUserEmail(); 
app.add(app.createLabel('Your email address is ' + value)); 

// Return the UI App 
return app; 
} 

function logActiveUserEmail() 
{ 
var email = Session.getActiveUser().getEmail(); 
Logger.log(email); 
return email; 
} 
+0

哇,我缺乏太多的抱歉我是新來的,感謝有關UIApp的信息,並感謝您的幫助=) –

相關問題