我有一个当前创建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;
}
使用此方法创建的所有日历都会创建仅对组织可见的日历。如何将它们设置为公开显示?
答案 0 :(得分:2)
AclRule aclRule = new AclRule()
{
Role = "owner",
Scope = new AclRule.ScopeData()
{
Type = "user",
Value = email.ToString()
}
};
_service.Acl.Insert(aclRule, calendarId).Execute();
答案 1 :(得分:0)
根据Google日历API,Access Control Lists (ACLs)看起来像您的解决方案。尝试它显示的PATCH方法。