I'm using the Google Calendar API to add a specific calendar and then add an event in it.
I'm able to do it only for one calendar. (my personnal calendar, logged with the API function : DoAuth()
I have 2 questions :
- How can I add the same event in another calendar at the same time ?
- Is it possible to execute DoAuth() without having the google log in window ?
Maybe I can use the API Key, but I can't figure how to code the authentification part.
Here is some basic code I made :
//-------------------------------------------------------------------------
// FORM CREATE
//-------------------------------------------------------------------------
procedure TForm1.FormCreate(Sender: TObject);
begin
AdvGCalendar1.DoAuth;
Edit1.SetFocus();
end;
//------------------------------------------------------------------------
// ADD CALENDAR
//-------------------------------------------------------------------------
procedure TForm1.bt_ajouterCalendrierClick(Sender: TObject);
var
grem: TGReminder;
begin
Screen.Cursor := crHourGlass;
gcal := AdvGCalendar1.Calendars.Add;
gcal.Summary := 'Calendrier X';
gcal.Description := 'Description X';
gcal.Location := 'Locaux X';
gcal.TimeZone := 'UTC';
grem.Method := rmPopup;
grem.Minutes := 60;
grem := gcal.DefaultReminders.Add;
AdvGCalendar1.AddCalendar(gcal);
Screen.Cursor := crDefault;
end;
//-------------------------------------------------------------------------
// GET INFOS EVENT
//-------------------------------------------------------------------------
procedure TForm1.inputInfosRendezVous(Item: TGCalendarItem);
var dateDebut, dateFin : TDateTime;
begin
Item.Summary := 'Test event';
Item.Description := 'Test descirption';
Item.Location := 'Test location';
Item.Color := icBlue;
Item.IsAllDay := false;
Item.StartTime := PlannerCalendar1.Date;
Item.EndTime := PlannerCalendar2.Date;
Item.Visibility := viPublic;
end;
//-------------------------------------------------------------------------
// ADD EVENT TO CALENDAR
//-------------------------------------------------------------------------
procedure TForm1.bt_ajouterRendezVousClick(Sender: TObject);
var
event: TGCalendarItem;
begin
Screen.Cursor := crHourGlass;
event := AdvGCalendar1.Items.Add;
inputInfosRendezVous(event);
event.CalendarID := gcal.ID;
AdvGCalendar1.Add(event);
Screen.Cursor := crDefault;
end;
Thank you in advance for your help.