如何使用Google Calendar v3访问其他用户的日历? [英] How do I access other users calendars with google calendar v3?

查看:187
本文介绍了如何使用Google Calendar v3访问其他用户的日历?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Google Calendar(v3)API与google应用程序配合使用,并希望使用一个oauth2凭据来确定在任何给定时间哪些用户忙/闲.

I am using the Google Calendar (v3) API, with google apps and am wanting to use a single oauth2 credential to determine what users are free/busy at any given point.

我想使用这个: https://developers.google.com/google-apps/calendar /v3/reference/freebusy/query

但是要使用此功能,我需要获取所有用户的所有日历ID.我无法执行此操作,因为Google日历的Java客户端只能检索拥有该凭证的用户的日历.

But to use this I need to get all the calendar ids for all the users. I cannot do this as the java client for the google calendar can only retrieve calendars of the user who owns the credential.

注意:我可以通过配置api访问所有用户.

Note: I have access to all the users through the provisioning api.

任何帮助将不胜感激,因为我对此一无所知.

Any help would be much appreciated as I am totally blocked by this.

推荐答案

对于主日历,calendarId是用户的电子邮件地址.经过身份验证的用户还需要具有访问日历的权限.如果您使用的是Provisioning API,那么我假设您是超级管理员,超级管理员可以访问其域中的每个日历.

For primary calendars, the calendarId is the user's email address. The authenticated user will also need to have permission to access the calendar. If you're using the Provisioning API then I'll assume you are a super admin, and super admins can access every calendar on their domain.

您要尝试执行的特定查询需要一个calendarIds列表作为JSON列表进行查询.如果您只关心主日历,则将每个用户的电子邮件设置为如下ID:

The specific query you are trying to do takes a list of calendarIds to query as a JSON list. If you are only concerned about primary calendars, then set each user's email as an id like this:

"items": [
  {
    "id": "user1@example.com"
  },
  {
    "id": "user2@example.com"
  }
]

这篇关于如何使用Google Calendar v3访问其他用户的日历?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆