【问题标题】:Set event author with Google Calendar API使用 Google Calendar API 设置事件作者
【发布时间】:2011-06-29 19:01:29
【问题描述】:

我正在尝试在使用此代码将事件添加到 Google 日历时设置作者:

        CalendarService service = new CalendarService("TestApp");
        service.setUserCredentials("example@gmail.com", "1234");

        EventEntry entry = new EventEntry();

        // Set the title and content of the entry.
        entry.Title.Text = "Test";
        entry.Content.Content = "Test";

        // Not working
        AtomPerson author = new AtomPerson(AtomPersonType.Author);
        author.Name = "John Doe";
        author.Email = "john@example.com";
        entry.Authors.Add(author);

        When eventTime = new When(activity.Start, activity.End, activity.Start == activity.End ? true : false);
        entry.Times.Add(eventTime);

        Uri postUri = new Uri("https://www.google.com/calendar/feeds/default/private/full");

        // Send the request and receive the response:
        AtomEntry insertedEntry = service.Insert(postUri, entry);

添加了除作者之外的所有正确属性的事件。作者仍然是日历的所有者。有什么想法吗?

【问题讨论】:

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


    【解决方案1】:

    根据日历 API 文档 (http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#CreatingSingle):

    服务器会根据用户插入作者信息 提交请求(即其身份验证令牌的用户 伴随请求)。

    创建事件时无法设置作者字段的值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-09
      相关资源
      最近更新 更多