Google Calendar 脚本用于将域的所有日历与外部数据库同步
我们有针对我们领域(教育)的谷歌应用程序。在我们的学生数据库系统中,我们拥有所有班级信息。
我们想编写一个同步过程,强制所有教师和学生日历与谷歌日历同步。这一切看起来都很简单……减去所有的“假设”,但这需要时间来弄清楚。
我目前在尝试决定如何通过谷歌进行身份验证时遇到了困难。由于单个用户每天可以进行的通话量是有限的,因此我实际上无法让一个管理员用户帐户负责同步每个人。
有人可以告诉我应该采取哪个身份验证方向吗?我不需要用户登录,我只需要写入他们的所有日历。我听说过提到 2 条腿的 OAuth,但我对正确答案感到困惑,并且确实需要一些关于使用什么的指导。
非常感谢。
We have google apps for our domain (education). In our student database system we have all the class information.
We would like to write a sync process that forces all faculty and student calendars to be synced with google calendar. This all seems simple enough...minus all the "what ifs" but that will just take time to figure out.
I'm currently hitting a wall when trying to decide how to authenticate with google. Since there are limits on the amount of talking a single user can do per day I can't really have one admin user account in charge of syncing everyone.
Can someone tell me which authentication direction I should take with this? I don't need users to log in, I just need to write to all of their calendars. I have heard mentions of 2 legged OAuth, but I am confused on exactly what is the right answer and really need some guidance on what to use.
Thanks much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是我用于类似项目的一些代码片段。我使用了 google api 和 .net 框架,这比使用 OAuth 更容易。这些片段位于 Visual Basic 中。
总之,我只是使用 google 为 .net 框架提供的日历服务类。 FstrEmail 只是与日历关联的电子邮件地址,FstrPassword 是常规的 Google 密码。 FURLNoCookie 实际上是您指定它转到哪个日历的地方。这只是日历的 XML 私人共享 URL(从日历设置>私人地址获取)。当您第一次从日历中获取此 URL 时,它将如下所示
将其修改为如下所示
类似的过程可用于更新和删除条目。我用它来将电子表格与多个谷歌日历同步,效果很好。
Here are some snippets of code that I used for a similar project. I used the google api and .net framework which made it a lot easier than using OAuth. These snippets are in Visual Basic
In summary I was just using the Calendar Service class provided by google for the .net framework. The FstrEmail is just the email address associated with the calendar and FstrPassword is the regular google password. FURLNoCookie is actually where you specify what calendar it goes to. This is just the XML private sharing URL for the calendar (gotten from calendar settings>private address). When you first get this URL from the calendar it will look something like this
Modify it to look like this
A similar process can be used for updating and deleting entries. I use this to sync a spreadsheet with multiple google calendars and it works fine.