以下函数返回url的空值 function test(){
var folderiter = DriveApp.getFolders();
while (folderiter.hasNext()) {
var folder = folderiter.next();
Logger.log(folder.getName()+" url:"+folder.getUrl())
}
}
答案 0 :(得分:0)
function myFunction() {
var folderiter = DriveApp.getFolders();
while (folderiter.hasNext()) {
var folder = folderiter.next()
var folderId = folder.getId()//new line added to your code
//DocsList.getFolderById(folderId).getURL() works to get url as variable
var url = DocsList.getFolderById(folderId).getUrl()
Logger.log(folder.getName()+" url:"+url)//modified to use variable instead of method
}
}
我使用自己的文件夹和文件对此进行了测试,但我无法确认它是否适用于每种文件/文件夹类型。但是,如果它对你有帮助,你能接受答案吗?