google-drive-api - 如何开始测试我的 Google Drive UI 集成?
问题描述
我开始开发 Google Drive UI 集成,但我遇到了一个相当基本的问题。我找不到开始测试我的集成的选项。
到目前为止,我已经完成了以下工作:
- 我在 Google API 控制台 ( https://console.developers.google.com/ ) 中创建了一个新项目。
- 我为此项目启用了“G Suite Marketplace SDK”和“Google Drive API”服务。
- 我创建了一个 Oauth 同意屏幕并设置了凭据。
我还需要做什么才能让我的集成显示在 Google 云端硬盘中?我可以将已发布的公共插件添加到我的 Google Drive,但由于某种原因,我无法开始使用我的新项目。我在哪里可以找到它?
解决方案
回答
由于您的加载项是an add-on that simply opens a document in our web app
您正在寻找工作区加载项,因此为了在不使用 G-Suite 域的情况下手动安装您的加载项。您应该按照本快速入门中的说明从清单部署您的 Apps 脚本项目。
请记住,之前的快速入门遵循的是旧版 Apps 脚本编辑器。此示例有一个清单文件示例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将处理选择项目的事件,并将运行之前在快速入门示例中定义的onDriveItemsSelected函数。您可以在此处查看所有相关的事件触发器。
安装插件后,它将显示在manifest 中定义的每个服务的 UI 中。请记住,这只是一个自我安装教程,您应该按照本教程发布您的附加组件,以便其他人能够安装它。
推荐阅读
- python - RSA 解密后 AES 密钥出错
- python-3.x - OpenCV 错误 -215:断言失败,无法弄清楚如何诊断此错误
- javascript - 在点击提交后根据单选按钮和输入字段的值过滤React中的表中的数据失败
- python - 查找两个 HTML 标记之间的内容
- c++ - 如何使 C++ 代码更快:使用 CFile 从相机数据创建 .csv 文件
- git - 在单独的终端屏幕上显示 git diff 和 git log 输出
- sha256 - 假设我拥有正确的公钥,此消息中包含的具体数据用于验证此消息中的签名?
- javascript - 制表符表的 Web 组件支持
- c++ - 使用管道在 C++ 中创建调度队列/线程处理程序:FIFO 溢出
- javascript - 使用 javascript 在悬停时播放视频