How to get back the ID of the freshly created Calendar item?

Hello,

After creating a new Calendar item, I need to get back the ID, but it is empty. How can I get it?

       CalendarItem := fs_CloudGoogleCalendar.Items.Add;

       With CalendarItem Do
        Begin
          StartTime := EncodeDate(Year, Month, Day) + EncodeTime(Hour, Minute, Second, 0);
          EndTime   := EncodeDate(Year, Month, Day) + EncodeTime(Hour, Minute, Second, 0);

          Summary := FieldByName('Caption').AsString;
          Description := FieldByName('Message').AsString;
          Location := FieldByName('Location').AsString;

          CalendarID := MyId; //

          Color := TTMSFNCCloudGoogleCalendarItemColorValue.icPurple;
        End;

        fs_CloudGoogleCalendar.Add(CalendarItem);
		
		FieldByName('google_id').AsString := CalendarItem.ID; //*here CalendarItem.ID is still empty string*

Thank you!

Hello,

Because there was no answer, after a few days I figured that I would use CloudGoogleCalendarRequestsComplete. I hope it was a good approach.

Hi,

This is indeed a good approach. As requests to the service API are asynchronous, it is required to use events to be able to access data retrieved from the API.