找不到从Java执行Google脚本的授权功能(Google App脚本)

时间:2019-09-28 15:06:45

标签: java google-apps-script netbeans

我已经从https://developers.google.com/apps-script/api/how-tos/execute复制了此代码,但是我的IDE告诉我,方法(在methode getScriptService()中)未被识别。

PS: 另外,我手动添加了APPLICATION_NAME,JSON_FACTORY,HTTP_TRANSPORT,TOKENS_DIRECTORY_PATH字段,因为未指定它们并导致错误。 / 在这里编码 /

  public static Script getScriptService() throws IOException,GeneralSecurityException 
   {

    final NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();

    Credential credential=authorize();

    return new Script.Builder(HTTP_TRANSPORT, JSON_FACTORY, setHttpTimeout(credential)).setApplicationName(APPLICATION_NAME).build();
}

0 个答案:

没有答案