【问题标题】:Programatically set a Google Calendar sharing settings to "Make this calendar public"以编程方式将 Google 日历共享设置设置为“公开此日历”
【发布时间】:2011-10-08 20:09:15
【问题描述】:

我有一个当前创建 Google Apps 日历的应用程序,现在需要能够公开这些日历(对全世界可见,而不是仅对组织可见,这似乎是默认设置)。

我目前正在运行以下代码来创建日历:

public CalendarEntry CreateCalendar(string title, string summary, string timezone, bool ispublic)
{
    CalendarEntry calendar = new CalendarEntry();
    calendar.Title.Text = title;
    calendar.Summary.Text = summary;
    calendar.TimeZone = timezone;


    Uri postUri = new Uri("https://www.google.com/calendar/feeds/default/owncalendars/full");
    CalendarEntry createdCalendar = (CalendarEntry) _calendarService.Insert(postUri, calendar);

    return createdCalendar;
}

使用此方法创建的所有日历都会创建仅对组织可见的日历。如何将它们设置为公开可见?

【问题讨论】:

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


    【解决方案1】:
                AclRule aclRule = new AclRule()
                {
                    Role = "owner",
                    Scope = new AclRule.ScopeData()
                    {
                        Type = "user",
                        Value = email.ToString()
                    }
                };
                _service.Acl.Insert(aclRule, calendarId).Execute();
    

    【讨论】:

    • 添加解释会很有帮助
    【解决方案2】:

    根据 Google 日历 API,Access Control Lists (ACLs) 看起来像您的解决方案。试试它显示的 PATCH 方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-21
      • 1970-01-01
      • 2015-03-06
      • 2017-10-16
      相关资源
      最近更新 更多