如何开始测试我的Google Drive UI集成



我开始开发Google Drive UI集成,但我遇到了一个相当基本的问题。我找不到开始测试集成的选项。

到目前为止,我已经做了以下工作:

  • 我在Google API控制台中创建了一个新项目(https://console.developers.google.com/)
  • 我启用了";G Suite Marketplace SDK";以及";Google Drive API";为该项目提供服务
  • 我创建了一个Oauth同意屏幕并设置凭据

我还需要做什么才能让我的集成显示在Google Drive中?我可以将已发布的公共插件添加到我的Google Drive中,但由于某种原因,我无法开始使用我的新项目。我在哪里能找到它?

答案

有两种类型的附加组件:

  • 谷歌工作区加载项
  • 编辑器加载项

由于您的加载项是an add-on that simply opens a document in our web app,因此您正在寻找工作区加载项,以便在不使用G-Suite域的情况下手动安装加载项。您应该从清单部署您的应用程序脚本项目,如本快速启动中所述。

请记住,上一个快速启动是在旧版应用程序脚本编辑器之后进行的。这个示例有一个清单文件示例appsscript.json,它看起来像:

{
"timeZone": "America/New_York",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER",
"oauthScopes": [
"https://www.googleapis.com/auth/calendar.addons.execute",
"https://www.googleapis.com/auth/calendar.readonly",
"https://www.googleapis.com/auth/drive.addons.metadata.readonly",
"https://www.googleapis.com/auth/gmail.addons.current.action.compose",
"https://www.googleapis.com/auth/gmail.addons.current.message.readonly",
"https://www.googleapis.com/auth/gmail.addons.execute",
"https://www.googleapis.com/auth/script.locale"],
"runtimeVersion": "DEPRECATED_ES5",
"addOns": {
"common": {
"name": "Cats",
"logoUrl": "https://www.gstatic.com/images/icons/material/system/1x/pets_black_48dp.png",
"useLocaleFromApp": true,
"homepageTrigger": {
"runFunction": "onHomepage",
"enabled": true
},
"universalActions": [{
"label": "Learn more about Cataas",
"openLink": "https://cataas.com"
}]
},
"gmail": {
"contextualTriggers": [{
"unconditional": {
},
"onTriggerFunction": "onGmailMessage"
}],
"composeTrigger": {
"selectActions": [{
"text": "Insert cat",
"runFunction": "onGmailCompose"
}],
"draftAccess": "NONE"
}
},
"drive": {
"onItemsSelectedTrigger": {
"runFunction": "onDriveItemsSelected"
}
},
"calendar": {
"eventOpenTrigger": {
"runFunction": "onCalendarEventOpen"
}
}
}
}

oauthScopes将请求每个应用程序的权限,addOns.common则将为下面定义的所有服务定义公共参数,类似于addOns.drive。在drive服务中,您将看到onItemsSelectedTrigger,它将处理选择项目的事件,并运行先前在Quickstart示例中定义的onDriveItemsSelected功能。您可以在此处查看所有相关的事件触发器。

安装插件后,它将显示在清单中定义的每个服务的UI中。请记住,这只是一个自安装教程,您应该遵循本教程来发布您的附加组件,以便其他人能够安装它。

最新更新