2012-06-08 35 views
0

我正在使用Google Spreadsheet創建一個腳本文件,該腳本文件必須處理在我的Google Apps域中獲取用戶信息的操作。我有管理員權限並且啓用了配置API。在我的代碼中,我試圖在Google Apps Domain(未找到用戶)上查找特定用戶時發現錯誤,而是顯示一條消息並繼續執行其餘的程序。當用戶沒有錯誤時,我在這裏的try-catch語句有效。但是,當檢索用戶時出現錯誤時,出現錯誤:「繼續序列化時出現意外異常」。這裏是我的代碼:Google Apps腳本中的Usermanager.getUser()發生錯誤

function testOfDomainAccess() { 

var i=0; 
var anArray= ["johhn.smith", "susan.que]; //john smith misspelled 
var user; 

for (i=0; i < anArray.length; ++i) 
{ 
Logger.log("\nThe current user being processed is " + anArray[i]); 

try 
{ 
user = UserManager.getUser (anArray [i]); 
} 
catch (error) 
{ 
    Browser.msgBox("Error: " + error.name + "\n Check your spreadsheet for misspellings of " + anArray[i] + " and We will continue to the next user."); 
    user = null; 
} 

if (user != null) { 
//Perform tasks 
} 

else 
    Logger.log("User not found in domain. Moving on the next item in the array."); 
} 

如果有人可以幫助解決這個問題,我將不勝感激。我是Google Apps腳本和配置API的新手。謝謝!

回答