Hi all

I'm trying to create a event on a google calendar. Starting from "calendardemo" I create a new procedure to test my code and a button to execute.

Following code works properly: after execution I can see the event using a browser.

I know that recently a bug was closed (http://bugs.freepascal.org/view.php?id=29487) but I do not think it is the same problem.
Any suggestions?

Thanks

Marcello


procedure TMainForm.Insert;
var Entry: TEvent;
begin

  Entry:=TEvent.Create();
  try
    Entry.id := 'aaa' + FormatDateTime('yyyymmddhhnnss', Now);
    Entry.summary:=Format('test event: %s', [Entry.id]);
    Entry.description:='empty description, yeah!';
    Entry.location:='a location';
    Entry.start := TEventDateTime.Create();
    Entry.start.dateTime:= ComposeDateTime(EncodeDate(2016,7,16),EncodeTime(23 
-2,0,0,0));
    Entry.start.timeZone:='Europe/Rome';
    Entry._end := TEventDateTime.Create();
    Entry._end.dateTime := ComposeDateTime(EncodeDate(2016,7,16),EncodeTime(23 
-2,10,0,0));
    Entry._end.timeZone:='Europe/Rome';
    SaveRefreshToken;
    FCalendarAPI.EventsResource.Insert(FCurrentCalendar.ID, Entry);
  finally
    Entry.Free;
  end;
end;


Follow request.log

--------------------------------------------------------------------------------

Request : POST 
https://www.googleapis.com/calendar/v3/calendars/[email protected]/events

Headers:

Content-type:application/json

Authorization: Bearer 
ya29.CjUnA_TOUWN8YvS8KjqYqFtrIyfJEQPJkyrl36V4LuM8T90b6qwMKJ0j4kTsx3YrW42QKF0MAg

Body:

{ "description" : "empty description, yeah!", "end" : { "dateTime" : "2016-07-16T21:10:00.000Z", "timeZone" : "Europe\/Rome" }, "id" : "aaa20160721160146", 
"location" : "a location", "start" : { "dateTime" : "2016-07-16T21:00:00.000Z", "timeZone" : "Europe\/Rome" }, "summary" : "test event: aaa20160721160146" }

Trying multiple protocols.

--------------------------------------------------------------------------------

Response : 200 : OK

Headers:

Cache-Control: no-cache, no-store, max-age=0, must-revalidate

Pragma: no-cache

Expires: Mon, 01 Jan 1990 00:00:00 GMT

Date: Thu, 21 Jul 2016 14:01:46 GMT

Vary: X-Origin

Content-Type: application/json; charset=UTF-8

X-Content-Type-Options: nosniff

X-Frame-Options: SAMEORIGIN

X-XSS-Protection: 1; mode=block

Server: GSE

Alternate-Protocol: 443:quic

Alt-Svc: quic=":443"; ma=2592000; v="36,35,34,33,32,31,30,29,28,27,26,25"

Accept-Ranges: none

Vary: Origin,Accept-Encoding

Transfer-Encoding: chunked

Body:

{

 "kind": "calendar#event",

 "etag": "\"2938219412944000\"",

 "id": "aaa20160721160146",

 "status": "confirmed",

 "htmlLink": 
"https://www.google.com/calendar/event?eid=YWFhMjAxNjA3MjExNjAxNDYgbWFnZ2lvcmRvbW80bUBt";,

 "created": "2016-07-21T14:01:46.000Z",

 "updated": "2016-07-21T14:01:46.472Z",

 "summary": "test event: aaa20160721160146",

 "description": "empty description, yeah!",

 "location": "a location",

 "creator": {

  "email": "[email protected]",

  "self": true

 },

 "organizer": {

  "email": "[email protected]",

  "self": true

 },

 "start": {

  "dateTime": "2016-07-16T23:00:00+02:00",

  "timeZone": "Europe/Rome"

 },

 "end": {

  "dateTime": "2016-07-16T23:10:00+02:00",

  "timeZone": "Europe/Rome"

 },

 "iCalUID": "[email protected]",

 "sequence": 0,

 "reminders": {

  "useDefault": true

 }

}






--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to