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
(SQL Server) 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.
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int -- Important: Do not use nvarchar(max). See the warning about using nvarchar(max). DECLARE @sTmp0 nvarchar(4000) -- 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 1 or 0. -- 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" -- } -- ] -- } DECLARE @json int -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @success int EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'kind', 'calendar#event' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'etag', 'some_etag' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'id', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'status', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'htmlLink', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'created', 'datetime value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'updated', 'datetime value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'summary', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'description', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'location', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'colorId', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'creator.id', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'creator.email', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'creator.displayName', 'string value' EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'creator.self', 1 EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'organizer.id', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'organizer.email', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'organizer.displayName', 'string value' EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'organizer.self', 1 EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'start.date', 'date value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'start.dateTime', 'datetime value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'start.timeZone', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'end.date', 'date value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'end.dateTime', 'datetime value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'end.timeZone', 'string value' EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'endTimeUnspecified', 1 EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'recurrence[0]', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'recurringEventId', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'originalStartTime.date', 'date value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'originalStartTime.dateTime', 'datetime value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'originalStartTime.timeZone', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'transparency', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'visibility', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'iCalUID', 'string value' EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'sequence', '1234' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attendees[0].id', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attendees[0].email', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, '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.. EXEC sp_OASetProperty @json, 'I', 0 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'attendees[i].organizer', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'attendees[i].self', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'attendees[i].resource', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'attendees[i].optional', 1 EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attendees[i].responseStatus', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attendees[i].comment', 'string value' EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'attendees[i].additionalGuests', '1234' EXEC sp_OASetProperty @json, 'I', 1 EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attendees[i].id', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attendees[i].email', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attendees[i].displayName', 'string value' EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'attendees[1].organizer', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'attendees[1].self', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'attendees[1].resource', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'attendees[1].optional', 1 EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attendees[1].responseStatus', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attendees[1].comment', 'string value' EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'attendees[1].additionalGuests', '1234' EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'attendeesOmitted', 1 EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'extendedProperties.private.someKey', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'extendedProperties.shared.someKey', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'hangoutLink', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'gadget.type', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'gadget.title', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'gadget.link', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'gadget.iconLink', 'string value' EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'gadget.width', '1234' EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'gadget.height', '1234' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'gadget.display', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'gadget.preferences.someKey', 'string value' EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'anyoneCanAddSelf', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'guestsCanInviteOthers', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'guestsCanModify', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'guestsCanSeeOtherGuests', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'privateCopy', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'locked', 1 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'reminders.useDefault', 1 EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'reminders.overrides[0].method', 'string value' EXEC sp_OAMethod @json, 'UpdateNumber', @success OUT, 'reminders.overrides[0].minutes', '1234' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'source.url', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'source.title', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attachments[0].fileUrl', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attachments[0].title', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attachments[0].mimeType', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attachments[0].iconLink', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attachments[0].fileId', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attachments[1].fileUrl', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attachments[1].title', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attachments[1].mimeType', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attachments[1].iconLink', 'string value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'attachments[1].fileId', 'string value' EXEC sp_OASetProperty @json, 'EmitCompact', 0 EXEC sp_OAMethod @json, 'Emit', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @json END GO |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.