【问题标题】:Get Google Calendar and Events using Google service account使用 Google 服务帐户获取 Google 日历和活动
【发布时间】:2014-05-28 10:23:26
【问题描述】:

我想使用 Google 服务帐户获取用户的 Google 日历列表和事件。

我正在尝试使用 CalendarService,但找不到解决方案。

我的代码:

         string path = KeyPath;
        X509Certificate2 certificate = new X509Certificate2(
            path,
            "notasecret", X509KeyStorageFlags.Exportable);
        var provider = new AssertionFlowClient(GoogleAuthenticationServer.Description, certificate)
        {
            ServiceAccountId = "XXXXX@developer.gserviceaccount.com",
            Scope = "http://www.google.com/calendar/feeds/default/private/full"


        };
        var auth = new OAuth2Authenticator<AssertionFlowClient>(provider, AssertionFlowClient.GetState);


        var cService = new CalendarService(auth);

它显示错误 Calendarservice 有一些无效参数。我不知道如何处理这项服务。任何帮助将不胜感激。

【问题讨论】:

    标签: c# asp.net google-api google-calendar-api google-apps


    【解决方案1】:

    解决方案是与服务帐户共享现有日历

    <paste-your-account-here>@developer.gserviceaccount.com
    

    (您可以在 Google Developers Console 的凭据选项卡下找到相关帐户,称为“电子邮件地址”)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-29
      • 1970-01-01
      • 2020-08-27
      • 2021-10-31
      • 2021-12-08
      • 1970-01-01
      • 2014-11-21
      • 2020-08-11
      相关资源
      最近更新 更多