SuperAPI AI 工具集

recipe-share-doc-and-notify

办公与效率

查看项目

更新于 10-16 08:21

技能介绍

用途

这是一个 Google Workspace CLI 配方(recipe),目标是把一份 Google Docs 文档以编辑权限共享给协作者,并通过邮件把文档链接发送给对方,完成“共享 + 通知”的一体化操作。

前置条件

执行该配方前,需要先加载以下技能:

  • gws-drive
  • gws-docs
  • gws-gmail

主要步骤

1. 查找文档

使用 drive files list 按名称和 MIME 类型定位目标文档:

gws drive files list --params '{"q": "name contains '\''Project Brief'\'' and mimeType = '\''application/vnd.google-apps.document'\''"}'

该命令会返回匹配的文档,从中获取后续步骤所需的 DOC_ID。

2. 授予编辑权限

使用 drive permissions create 为指定邮箱创建 writer(编辑者)权限:

gws drive permissions create --params '{"fileId": "DOC_ID"}' --json '{"role": "writer", "type": "user", "emailAddress": "reviewer@company.com"}'

其中 fileId 替换为实际文档 ID,emailAddress 替换为协作者邮箱,role 为 writer 表示编辑权限。

3. 发送邮件通知

使用 gmail +send 向协作者发送包含文档链接的邮件:

gws gmail +send --to reviewer@company.com --subject 'Please review: Project Brief' --body 'I have shared the project brief with you: https://docs.google.com/document/d/DOC_ID'

邮件正文中包含文档链接,链接格式为 https://docs.google.com/document/d/DOC_ID。

适用场景

适用于需要将 Google Docs 文档共享给他人并同时通知对方的场景,例如请同事审阅项目简报、向协作者开放文档编辑权限并告知链接等。

限制

资料中未提供关于权限范围、配额、错误处理、批量操作或平台兼容性等方面的更多说明。