有没有办法找到所有拥有的 Google 协作平台的已发布网址?

发布于 2025-01-12 21:02:38 字数 1558 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

無心 2025-01-19 21:02:38

目前无法使用 GAM 获取网站的已发布 URL。 GAM 依赖于 Google 的 API,并且没有可用于新站点的 API:

站点 API 目前仅支持经典站点。这些 API 不支持新站点。
-- https://support.google.com/a/answer/7181011? hl=zh-cn

尽管 Google 一再保证新协作平台能够实现经典协作平台所做的一切,但七年的时间只是众多未填补的空白之一。

如果您只对具有“自定义网址”的网站感兴趣,可以在 Google Workspace 管理员中的“应用”→“Google Workspace”→“网站”→“自定义网址”下轻松查看这些网站:

显示自定义 URL 映射位置的屏幕截图

如果您愿意知道对于所有网站,据我所知没有好的解决方案。一种可能的解决方法是让自己使用 GAM 访问每个站点,然后手动或使用某种 RPA 或浏览器脚本工具检查每个站点。

在开始此路径之前,请生成域中所有网站的列表并将其导出到 Google 表格(结果的数量可能会帮助您决定实现此想法的程度):

gam all users show filelist todrive query "mimeType = 'application/vnd.google-apps.site'"

提示:缩小此命令以及此处列出的所有其他 GAM 命令的范围,您可能需要将所有用户替换为ou“OU/Sub-OU”,或者您可以审核通过将用户添加到名为 [电子邮件受保护] 并使用 group整个站点审核用户

如果您决定继续,主要步骤如下:

  1. 创建用于此过程的“审核员”组
  2. 授予审核员组对域中所有站点的编辑权限
  3. 检查所有站点(手动或自动)
  4. 删除审核员组

1创建 Auditor 组并添加您自己

gam create group name "Sites Auditor - April 2023" email [email protected]
gam update group [email protected] add owner user [email protected]

2. 授予 Auditor 组对所有站点的访问权限

gam all users show filelist id title alternateLink query "mimeType = 'application/vnd.google-apps.site'" | tee sites.csv | gam csv - gam user ~Owner add drivefileacl ~id group [email protected] role editor

注意: 这使用 tee 将输出传送到下一个 GAM 命令 将其保存到当前目录中名为 sites.csv 的文件。 Windows 用户可能需要自行安装 tee 版本才能使此命令发挥作用。

3. 检查所有站点

这些站点将全部列在 sites.csv 中。您可以使用 alternateLink 列中的 URL 打开每个站点的编辑界面(手动或以编程方式)。

如果手动检查,请打开“发布”下拉菜单下的“发布设置...”屏幕:

显示“发布设置...”菜单选项的屏幕截图

如果使用某种浏览器脚本或 RPA 进行检查诸如 Selenium, UIPath< /a> 或 Power Automate,请注意,某些网站可能有一个或多个自定义 URL除了他们的“正常”URL:

带有其他自定义 URL 的网站的屏幕截图

4. 删除 Auditor 组

可选但彻底:删除组将有效地删除所有站点的权限,但已删除组的 ACL 条目将保留在每个文件中。如果您希望更彻底,您应该首先使用我们之前保存的 CSV 从每个文件中删除审核员组权限:

gam csv site.csv gam 用户 ~所有者删除drivefileacl ~id 组 [电子邮件受保护]
gam delete group [email protected]

It's not currently possible to get a site's published URL using GAM. GAM relies on Google's APIs and there is not one available for new Sites:

The Sites APIs currently support only classic Sites. These APIs do not support new Sites.
-- https://support.google.com/a/answer/7181011?hl=en

Despite Google's repeated assurances that new Sites would be able to do everything classic Sites did, seven years on this is one of a number of unfilled gaps.

If you are only interested in sites with a "Custom URL," these can easily be viewed in the Google Workspace Admin under Apps → Google Workspace → Sites → Custom URL:

Screenshot showing where to find Custom URL mapping

If you want to know about all sites, there is no good solution I'm aware of. One possible workaround is to give yourself access to every single site using GAM and then inspect each Site manually or using some sort of RPA or browser scripting tool.

Before you start down this path, generate a list of all the Sites in your domain and export it to Google Sheets (the quantity of results might help you decide how far to pursue this idea):

gam all users show filelist todrive query "mimeType = 'application/vnd.google-apps.site'"

Hint: To narrow down the scope of this and all other GAM commands listed here you may want to replace all users with ou "OU/Sub-OU" or you could audit a subset of users by adding them to a new group called [email protected] and use group sites-audit-users throughout.

If you decide to proceed, the high level steps are:

  1. Create an "Auditor" group to use for this process
  2. Give the Auditor group edit access to all the sites in the domain
  3. Inspect all the sites (manually or automatically)
  4. Delete the Auditor group

1. Create Auditor group and add yourself

gam create group name "Sites Auditor - April 2023" email [email protected]
gam update group [email protected] add owner user [email protected]

2. Give the Auditor group access to all sites

gam all users show filelist id title alternateLink query "mimeType = 'application/vnd.google-apps.site'" | tee sites.csv | gam csv - gam user ~Owner add drivefileacl ~id group [email protected] role editor

Note: This uses tee to both pipe the output to the next GAM command and save it to a file called sites.csv in your current directory. Windows users may need to install a version of tee themselves for this command to work.

3. Inspect all the sites

The sites will all be listed in sites.csv. You can open the edit interface for each site (manually or programmatically) using the URL in the alternateLink column.

If inspecting manually, open the "Publish settings..." screen under the "Publish" dropdown menu:

Screenshot showing the "Publish settings..." menu option

If inspecting using some sort of browser scripting or RPA tool such as Selenium, UIPath or Power Automate, be aware that some sites may have one or more custom URLs in addition to their "normal" URL:

Screenshot of a site with additional custom URLs

4. Delete the Auditor group

Optional but thorough: Deleting the group will effectively remove the permissions from all the sites but an ACL entry for the deleted group will remain in each file. If you wish to be more thorough you should first remove the Auditor group permission from each file using the CSV we saved earlier:

gam csv sites.csv gam user ~Owner delete drivefileacl ~id group [email protected]
gam delete group [email protected]
弃爱 2025-01-19 21:02:38

似乎无法从源云端硬盘文件中找到该网站的已发布 URL。

It does not appear to be possible to find the Site's published URL from the source Drive file.

陪我终i 2025-01-19 21:02:38

使用 GAM 无法找到工作区中的所有 google Drive 文件。

但是,可以使用 google Apps ScriptDriveApp 类。通过使用 getFiles() 函数(您可以阅读有关它的更多信息 此处)您可以检索 Google 云端硬盘中所有文件的列表。然后您可以轻松提取这些文件的 url,如下例所示。

function myFunction() {
  var iterator = DriveApp.getFiles();

  while (iterator.hasNext()){
    var file = iterator.next();
    console.log(file.getUrl());
  }
}

It is not possible to find all google Drive files in your workspace using GAM.

However,it can be easily achieved using google Apps Script and the DriveApp class. By using the getFiles() function (you can read more about it here) you can retrieve a list of all your files in Google Drive. Then you can extract the url of those files quite easily, like in the example below.

function myFunction() {
  var iterator = DriveApp.getFiles();

  while (iterator.hasNext()){
    var file = iterator.next();
    console.log(file.getUrl());
  }
}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文