Google Admin SDK允许开发人员编写应用程序来管理G Suite域,从现有IT基础架构迁移和集成,创建用户,更新设置,审核活动等。
使用 Google Apps 脚本记录共享驱动器中的文件信息并检索创建者的电子邮件
流程概述 我正在使用 Google 表格来记录有关共享 Google 云端硬盘文件夹中的文件的信息。目标是记录文件 ID、标题、URL、提交日期和时间等详细信息...
为什么当我使用其 API 创建 google 资源日历时它会变成不可用房间?
我将通过其API(即https://admin.googleapis.com/admin/directory/v1/customer/my_customer/resources/calendars)创建一个Google资源日历室。但问题是,当我创建...
AdminDirectory.Members.insert 习惯性地拒绝 @hotmail、@outlook 和其他电子邮件地址,并显示消息: errorException:电子邮件无效
我编写了一个脚本来将成员添加到 Google 群组。数据写入我的网站,保存到 Google 表格中,该表格启动脚本以将成员添加到组中。 代码正在运行
我如何自动导出 GWS 上的所有用户和状态(活动、暂停、已存档),然后将报告发送到用户列表
我正在尝试在我的 Google Workspace 帐户上自动生成用户报告,显示他们的状态,并每月通过电子邮件将报告发送给收件人列表。 我正在努力让所有用户都知道他们的
上下文 在预订酒店的表格 POST 中,我首先想检查我们的公寓是否有空闲房间。我通过 GSuite 管理面板创建了资源日历(包含建筑物等)。 现在我是
对于 Google 域中的用户,有一个名为 gidNumber 的属性。我知道如何访问此 ID 的唯一方法是连接到 Google Ldap。当我在 Google 管理目录中进行查询时,我
使用 google-api-php-client 创建通知通道
我想创建一个通知通道,以便每次从我的工作区删除用户时我的 php 应用程序都会收到通知,我正在使用以下命令 我想创建一个通知通道,以便每次从我的工作区删除用户时我的 php 应用程序都会收到通知,我正在使用以下内容 <?php namespace App\Services; use App\Models\Student; use Exception; use Google\Service\Directory\Channel; use Illuminate\Support\Str; class WorkspaceAdminService { /* * Email address for admin user that should be used to perform API actions * Needs to be created via Google Apps Admin interface and be added to an admin role * that has permissions for Admin APIs for Users */ protected string $delegatedAdmin; /* * Some name you want to use for your app to report to Google with calls, I assume * it is used in logging or something */ protected string $appName; /* * Array of scopes you need for whatever actions you want to perform * See https://developers.google.com/admin-sdk/directory/v1/guides/authorizing */ protected $scopes = array( \Google\Service\Directory::ADMIN_DIRECTORY_USER, \Google\Service\Directory::ADMIN_DIRECTORY_ORGUNIT, ); /* * Provide path to JSON credentials file that was downloaded from Google Developer Console * for Service Account */ protected $authJson; /** * @var \Google\Service\Directory $dir **/ protected $dir; public function __construct() { $authJson = resource_path('jsons/eservices-emails-creds.json'); $this->appName = env("GOOGLE_APP_NAME"); $this->delegatedAdmin = env("GOOGLE_DELEGATED_ADMIN"); /* * Create Google_Client for making API calls with */ $googleClient = new \Google\Client(); $googleClient->setApplicationName($this->appName); $googleClient->useApplicationDefaultCredentials(); $googleClient->setAuthConfig($authJson); $googleClient->setSubject($this->delegatedAdmin); $googleClient->setScopes($this->scopes); $googleClient->setAccessType('offline'); /* * Get an instance of the Directory object for making Directory API related calls */ $this->dir = new \Google\Service\Directory($googleClient); } public function watch(string $url) { $channel = new Channel(); $channel->setId(Str::uuid()->toString()); $channel->setAddress($url); $channel->setType('web_hook'); try { $this->dir->users->watch($channel, [ 'event' => 'delete', ]); } catch (Exception $e) { dd($e); } } } 但它抛出以下异常 { "error": { "code": 400, "message": "Bad Request", "errors": [ { "message": "Bad Request", "domain": "global", "reason": "badRequest" } ] } } 注意 jsons/eservices-emails-creds.json 是从控制台下载的凭证文件,在添加像 $this->dir->users->insert($user) 这样的用户时它可以工作,但创建通知通道失败 尝试在参数数组中添加域: $this->dir->users->watch($channel, [ 'event' => 'delete', 'domain' => 'yourdomain.com' ]); 我将此类用于 $channel 变量: $channel = new Google_Service_Directory_Channel();
我正在开发一个 WebApp 项目,其中包括一个用户系统。对于每个用户,我需要一个用户可以与之交互的事件日历(CRUD 操作)。我想使用 Google Cal...
如何管理 Google Workspace 中的已归档帐号?
我对 Google 世界非常陌生,正在尝试完成一些自动化,看看下面的内容是否适用于应用程序脚本。我也不是Java人,所以我尽力了。我们使用 Okta 作为我们的 SSO。一旦成为用户
背景 我们的企业用户拥有 Google Apps 帐户。我们希望允许他们(并且只有他们)使用 Google 帐户登录酒店后台。理想情况下,我们也想管理
无法使用 Google Admin SDK Directory API 和服务帐户访问用户数据
我在尝试通过服务帐户使用 Google Admin SDK Directory API 访问用户数据时遇到问题。这是场景: 我有一个利用 Google ...
如何在我的 flutter 中实现 Admin SDK,以便我可以从管理面板管理用户?
我刚开始从事我的毕业项目。我想在我的应用程序中实现管理功能。到目前为止,我已经实现了数据流和身份验证,但我陷入了
我正在尝试使用 AWS 设置 Google Identity Federation,以便从 aws lambda 函数进行 admin.directory API 调用。它是用 Java 编写的。 我设置了工作负载池,创建了服务帐户并
我需要以编程方式检查管理控制台中的设置是否打开或关闭。 例如: 1. 以管理员身份登录admin.google.com。 2. 选择应用程序。 3. 选择 Google Workspace。 4. 选择 Gmail。 5.
用于请求用户列表的 C# Google API 返回“badRequest”
我这几天一直在寻找这方面的信息。我相信我已正确设置与 API 相关的所有内容以供访问,但我不断收到此错误: 服务管理员有...
检索用户的所有组 ->Google Directory API
我正在尝试创建一个页面,我的 NGO 内的用户可以使用其 GSuite 帐户登录。他们的组成员身份将决定他们可以看到页面的哪些部分。当我年轻的时候,我...
通过 Google API 获取 Google Org 中的所有日历
目标:我正在尝试获取我的 Gsuite 组织中的所有日历。 问题:我知道我可以使用 CalendarList.list 获取日历列表,但前提是用户或服务帐户拥有所有日历...
来自 Google Workspace 的用户邮箱使用情况报告
我正在尝试获取基本的电子邮件使用情况报告。我们需要获取用户名及其电子邮箱的大小。下面提供的代码抛出异常 ” 我正在尝试获取基本的电子邮件使用情况报告。我们需要获取用户名及其电子邮箱的大小。下面提供的代码抛出异常 ”https://admin.googleapis.com/admin/directory/v1/users?alt=json 返回“错误请求”。详细信息:“[{'message': '错误请求', 'domain': ' global', 'reason': 'badRequest'}]">**" 就行了 users = service.users().list().execute() 完整代码如下: from __future__ import print_function import os.path import csv import io from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials from google_auth_oauthlib.flow import InstalledAppFlow from googleapiclient.discovery import build # If modifying these scopes, delete the file token.json. #SCOPES = ['https://www.googleapis.com/auth/admin.directory.user.readonly'] SCOPES = ['https://admin.googleapis.com/admin/directory/v1/users'] creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists('token.json'): creds = Credentials.from_authorized_user_file('token.json', SCOPES) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file( 'credentials.json', SCOPES) creds = flow.run_local_server(port=0) # Save the credentials for the next run with open('token.json', 'w') as token: token.write(creds.to_json()) service = build('admin', 'directory_v1', credentials=creds) print('Getting users in the domain') users = service.users().list().execute() # Create a dictionary to store the user data. user_data = {} # Iterate over the list of users and get their first name, last name, and mailbox size. for user in users["users"]: user_data[user["primaryEmail"]] = { "firstName": user["name"]["givenName"], "lastName": user["name"]["familyName"], "mailboxSize": user["storage"]["quotaUsage"], } # Open the CSV file for writing. with open("user_data.csv", "w", newline="") as f: writer = csv.writer(f) # Write the header row. writer.writerow(["email", "firstName", "lastName", "mailboxSize"]) # Iterate over the user data and write each user's data to a new row in the CSV file. for email, data in user_data.items(): writer.writerow([email, data["firstName"], data["lastName"], data["mailboxSize"]]) # Close the CSV file. f.close() 凭证正确。测试多次。正如您从示例中看到的,我尝试使用不同的范围。 我在这里做错了什么? 你错过了你的customer='my_customer': from __future__ import print_function import os.path from google.auth.transport.requests import Request from google.oauth2.credentials import Credentials from google_auth_oauthlib.flow import InstalledAppFlow from googleapiclient.discovery import build # If modifying these scopes, delete the file token.json. SCOPES = ['https://www.googleapis.com/auth/admin.directory.user'] USER_TOKEN = "token_create_user.json" CREDENTIALS = 'C:\Development\FreeLance\GoogleSamples\Credentials\Workspace-Installed-TestEverything.json' def main(): """Shows basic usage of the Admin SDK Directory API. Prints the emails and names of the first 10 users in the domain. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists(USER_TOKEN): creds = Credentials.from_authorized_user_file(USER_TOKEN, SCOPES) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) else: flow = InstalledAppFlow.from_client_secrets_file( CREDENTIALS, SCOPES) creds = flow.run_local_server(port=0) # Save the credentials for the next run with open(USER_TOKEN, 'w') as token: token.write(creds.to_json()) service = build('admin', 'directory_v1', credentials=creds) # Call the Admin SDK Directory API print('Getting the first 10 users in the domain') results = service.users().list(customer='my_customer', maxResults=10, orderBy='email').execute() users = results.get('users', []) if not users: print('No users in the domain.') else: print('Users:') for user in users: print(u'{0} ({1})'.format(user['primaryEmail'], user['name']['fullName'])) if __name__ == '__main__': main()
如何使用 api 和 .Net 更改 google 群组成员的传送设置
如何使用 google api 更改 google 群组成员的传送设置? 在使用用户界面的 Google 群组中,我可以更改每个成员的传送设置: - 没有电子邮件 -
尽管截至今天的文档有所说明,我还是设法通过服务帐户使用 Apps 脚本 API 我正在尝试找到一种方法,以编程方式为我的所有域启用 Apps 脚本 API