我正在与Google日历进行集成,但是有关事件中的弹出通知的问题。
我首先通过APIS创建日历,然后创建CalendarList,然后为特定用户创建日历访问规则,最后创建事件。
发生的是,我通过规则添加的该用户没有收到我在CalendarList和Event中创建的通知。
public void calendar()
{
Calendar calendar = new Calendar();
calendar.Summary = "Calendar Test";
calendar.Description = "Calendar description";
calendar.TimeZone = "America/Sao_Paulo";
calendar.Location = "Name site";
var result = service.Calendars.Insert(calendar).Execute();
}
public void calendarList(string calendarId)
{
CalendarListEntry calendarList = new CalendarListEntry();
calendarList.Id = calendarId;
calendarList.Selected = true;
calendarList.Primary = false;
calendarList.ColorId = "11";
calendarList.DefaultReminders = EventReminder();
var result = service.CalendarList.Insert(calendarList).Execute();
}
public List<EventReminder> LembreteEvento()
{
List<EventReminder> events = new List<EventReminder>();
EventReminder reminder = new EventReminder();
reminder.Method = "popup";
reminder.Minutes = 5;
events.Add(reminder);
return events;
}
public void createRule()
{
AclRule rule = new AclRule();
ScopeData scope = new ScopeData();
scope.Type = "user";
scope.Value = "teste@gmail.com";
rule.Role = "reader";
rule.Scope = scope;
var result = service.Acl.Insert(rule, idCalendario).Execute();
}
private void createEvent(string calendarId)
{
Event event = new Event();
event.Summary = "Name Event";
event.Description = "Description Event";
event.Location = "mysite";
EventDateTime dateStart = new EventDateTime();
dateStart.DateTime = "2019-04-09 10:00:00";
EventDateTime dateEnd= new EventDateTime();
dateEnd.DateTime = "2019-04-09 11:00:00";
event.Start = dataInicio;
event.End = dataFim;
event.GuestsCanInviteOthers = false;
event.GuestsCanModify = false;
event.GuestsCanSeeOtherGuests = false;
event.ColorId = "11";
evento.Locked = true;
event.PrivateCopy = true;
event.Visibility = "public";
event.Status = "confirmed";
event.Transparency = "transparent";
event.Creator = new Event.CreatorData()
{
DisplayName = "Name",
Email = "teste@gmail.com"
};
event.Organizer = new Event.OrganizerData()
{
DisplayName = "Name",
Email = "teste@gmail.com"
};
event.Source = new Event.SourceData()
{
Title = "Name",
Url = "mysite"
};
event.Reminders = new Event.RemindersData()
{
UseDefault = true
};
var request = Service.Events.Insert(event, calendarId).Execute();
}