Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Delphi DLL) Google Calendar -- Generate Event JSONSee more Google Calendar ExamplesDemonstrates how to generate the JSON for an event resource. This code can be used as a template for generating JSON to insert new events. See https://developers.google.com/google-apps/calendar/v3/reference/events#resource for details about the Calender Event Resource JSON.
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, JsonObject; ... procedure TForm1.Button1Click(Sender: TObject); var json: HCkJsonObject; begin // This example (below) generates the following JSON: // Note: Your application code would construct the event JSON using your // desired subset of members. For boolean values, you would pass True or False. // For date or date/time values, you would pass the appropriately formatted date/time string. // { // "kind": "calendar#event", // "etag": "some_etag", // "id": "string value", // "status": "string value", // "htmlLink": "string value", // "created": "datetime value", // "updated": "datetime value", // "summary": "string value", // "description": "string value", // "location": "string value", // "colorId": "string value", // "creator": { // "id": "string value", // "email": "string value", // "displayName": "string value", // "self": true // }, // "organizer": { // "id": "string value", // "email": "string value", // "displayName": "string value", // "self": true // }, // "start": { // "date": "date value", // "dateTime": "datetime value", // "timeZone": "string value" // }, // "end": { // "date": "date value", // "dateTime": "datetime value", // "timeZone": "string value" // }, // "endTimeUnspecified": true, // "recurrence": [ // "string value" // ], // "recurringEventId": "string value", // "originalStartTime": { // "date": "date value", // "dateTime": "datetime value", // "timeZone": "string value" // }, // "transparency": "string value", // "visibility": "string value", // "iCalUID": "string value", // "sequence": 1234, // "attendees": [ // { // "id": "string value", // "email": "string value", // "displayName": "string value", // "organizer": true, // "self": true, // "resource": true, // "optional": true, // "responseStatus": "string value", // "comment": "string value", // "additionalGuests": 1234 // }, // { // "id": "string value", // "email": "string value", // "displayName": "string value", // "organizer": true, // "self": true, // "resource": true, // "optional": true, // "responseStatus": "string value", // "comment": "string value", // "additionalGuests": 1234 // } // ], // "attendeesOmitted": true, // "extendedProperties": { // "private": { // "someKey": "string value" // }, // "shared": { // "someKey": "string value" // } // }, // "hangoutLink": "string value", // "gadget": { // "type": "string value", // "title": "string value", // "link": "string value", // "iconLink": "string value", // "width": 1234, // "height": 1234, // "display": "string value", // "preferences": { // "someKey": "string value" // } // }, // "anyoneCanAddSelf": true, // "guestsCanInviteOthers": true, // "guestsCanModify": true, // "guestsCanSeeOtherGuests": true, // "privateCopy": true, // "locked": true, // "reminders": { // "useDefault": true, // "overrides": [ // { // "method": "string value", // "minutes": 1234 // } // ] // }, // "source": { // "url": "string value", // "title": "string value" // }, // "attachments": [ // { // "fileUrl": "string value", // "title": "string value", // "mimeType": "string value", // "iconLink": "string value", // "fileId": "string value" // }, // { // "fileUrl": "string value", // "title": "string value", // "mimeType": "string value", // "iconLink": "string value", // "fileId": "string value" // } // ] // } json := CkJsonObject_Create(); CkJsonObject_UpdateString(json,'kind','calendar#event'); CkJsonObject_UpdateString(json,'etag','some_etag'); CkJsonObject_UpdateString(json,'id','string value'); CkJsonObject_UpdateString(json,'status','string value'); CkJsonObject_UpdateString(json,'htmlLink','string value'); CkJsonObject_UpdateString(json,'created','datetime value'); CkJsonObject_UpdateString(json,'updated','datetime value'); CkJsonObject_UpdateString(json,'summary','string value'); CkJsonObject_UpdateString(json,'description','string value'); CkJsonObject_UpdateString(json,'location','string value'); CkJsonObject_UpdateString(json,'colorId','string value'); CkJsonObject_UpdateString(json,'creator.id','string value'); CkJsonObject_UpdateString(json,'creator.email','string value'); CkJsonObject_UpdateString(json,'creator.displayName','string value'); CkJsonObject_UpdateBool(json,'creator.self',True); CkJsonObject_UpdateString(json,'organizer.id','string value'); CkJsonObject_UpdateString(json,'organizer.email','string value'); CkJsonObject_UpdateString(json,'organizer.displayName','string value'); CkJsonObject_UpdateBool(json,'organizer.self',True); CkJsonObject_UpdateString(json,'start.date','date value'); CkJsonObject_UpdateString(json,'start.dateTime','datetime value'); CkJsonObject_UpdateString(json,'start.timeZone','string value'); CkJsonObject_UpdateString(json,'end.date','date value'); CkJsonObject_UpdateString(json,'end.dateTime','datetime value'); CkJsonObject_UpdateString(json,'end.timeZone','string value'); CkJsonObject_UpdateBool(json,'endTimeUnspecified',True); CkJsonObject_UpdateString(json,'recurrence[0]','string value'); CkJsonObject_UpdateString(json,'recurringEventId','string value'); CkJsonObject_UpdateString(json,'originalStartTime.date','date value'); CkJsonObject_UpdateString(json,'originalStartTime.dateTime','datetime value'); CkJsonObject_UpdateString(json,'originalStartTime.timeZone','string value'); CkJsonObject_UpdateString(json,'transparency','string value'); CkJsonObject_UpdateString(json,'visibility','string value'); CkJsonObject_UpdateString(json,'iCalUID','string value'); CkJsonObject_UpdateNumber(json,'sequence','1234'); CkJsonObject_UpdateString(json,'attendees[0].id','string value'); CkJsonObject_UpdateString(json,'attendees[0].email','string value'); CkJsonObject_UpdateString(json,'attendees[0].displayName','string value'); // Note: We could alternately specify an index using "i", which allows // for an application to construct using a loop with a variable.. CkJsonObject_putI(json,0); CkJsonObject_UpdateBool(json,'attendees[i].organizer',True); CkJsonObject_UpdateBool(json,'attendees[i].self',True); CkJsonObject_UpdateBool(json,'attendees[i].resource',True); CkJsonObject_UpdateBool(json,'attendees[i].optional',True); CkJsonObject_UpdateString(json,'attendees[i].responseStatus','string value'); CkJsonObject_UpdateString(json,'attendees[i].comment','string value'); CkJsonObject_UpdateNumber(json,'attendees[i].additionalGuests','1234'); CkJsonObject_putI(json,1); CkJsonObject_UpdateString(json,'attendees[i].id','string value'); CkJsonObject_UpdateString(json,'attendees[i].email','string value'); CkJsonObject_UpdateString(json,'attendees[i].displayName','string value'); CkJsonObject_UpdateBool(json,'attendees[1].organizer',True); CkJsonObject_UpdateBool(json,'attendees[1].self',True); CkJsonObject_UpdateBool(json,'attendees[1].resource',True); CkJsonObject_UpdateBool(json,'attendees[1].optional',True); CkJsonObject_UpdateString(json,'attendees[1].responseStatus','string value'); CkJsonObject_UpdateString(json,'attendees[1].comment','string value'); CkJsonObject_UpdateNumber(json,'attendees[1].additionalGuests','1234'); CkJsonObject_UpdateBool(json,'attendeesOmitted',True); CkJsonObject_UpdateString(json,'extendedProperties.private.someKey','string value'); CkJsonObject_UpdateString(json,'extendedProperties.shared.someKey','string value'); CkJsonObject_UpdateString(json,'hangoutLink','string value'); CkJsonObject_UpdateString(json,'gadget.type','string value'); CkJsonObject_UpdateString(json,'gadget.title','string value'); CkJsonObject_UpdateString(json,'gadget.link','string value'); CkJsonObject_UpdateString(json,'gadget.iconLink','string value'); CkJsonObject_UpdateNumber(json,'gadget.width','1234'); CkJsonObject_UpdateNumber(json,'gadget.height','1234'); CkJsonObject_UpdateString(json,'gadget.display','string value'); CkJsonObject_UpdateString(json,'gadget.preferences.someKey','string value'); CkJsonObject_UpdateBool(json,'anyoneCanAddSelf',True); CkJsonObject_UpdateBool(json,'guestsCanInviteOthers',True); CkJsonObject_UpdateBool(json,'guestsCanModify',True); CkJsonObject_UpdateBool(json,'guestsCanSeeOtherGuests',True); CkJsonObject_UpdateBool(json,'privateCopy',True); CkJsonObject_UpdateBool(json,'locked',True); CkJsonObject_UpdateBool(json,'reminders.useDefault',True); CkJsonObject_UpdateString(json,'reminders.overrides[0].method','string value'); CkJsonObject_UpdateNumber(json,'reminders.overrides[0].minutes','1234'); CkJsonObject_UpdateString(json,'source.url','string value'); CkJsonObject_UpdateString(json,'source.title','string value'); CkJsonObject_UpdateString(json,'attachments[0].fileUrl','string value'); CkJsonObject_UpdateString(json,'attachments[0].title','string value'); CkJsonObject_UpdateString(json,'attachments[0].mimeType','string value'); CkJsonObject_UpdateString(json,'attachments[0].iconLink','string value'); CkJsonObject_UpdateString(json,'attachments[0].fileId','string value'); CkJsonObject_UpdateString(json,'attachments[1].fileUrl','string value'); CkJsonObject_UpdateString(json,'attachments[1].title','string value'); CkJsonObject_UpdateString(json,'attachments[1].mimeType','string value'); CkJsonObject_UpdateString(json,'attachments[1].iconLink','string value'); CkJsonObject_UpdateString(json,'attachments[1].fileId','string value'); CkJsonObject_putEmitCompact(json,False); Memo1.Lines.Add(CkJsonObject__emit(json)); CkJsonObject_Dispose(json); end; |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.