Returns events on the specified calendar.
This example returns the events for the calendar having the ID = "support@chilkatcloud.com"
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
DECLARE @sTmp0 nvarchar(4000)
DECLARE @rest int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Rest', @rest OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- Provide a previously obtained OAuth2 access token.
DECLARE @oauth2 int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.OAuth2', @oauth2 OUT
EXEC sp_OASetProperty @oauth2, 'AccessToken', 'OAUTH2_ACCESS_TOKEN'
EXEC sp_OAMethod @rest, 'SetAuthOAuth2', @success OUT, STR(@oauth2)
EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'www.googleapis.com', 443, 1, 1
IF STR(@success) <> 1
BEGIN
EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @oauth2
RETURN
END
DECLARE @sbJson int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbJson OUT
EXEC sp_OAMethod @rest, 'FullRequestNoBodySb', @success OUT, 'GET', '/calendar/v3/calendars/support@chilkatcloud.com/events', STR(@sbJson)
IF STR(@success) <> 1
BEGIN
EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @oauth2
EXEC @hr = sp_OADestroy @sbJson
RETURN
END
EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @iTmp0 OUT
IF @iTmp0 <> 200
BEGIN
EXEC sp_OAGetProperty @rest, 'ResponseStatusCode', @iTmp0 OUT
PRINT 'Received error response code: ' + @iTmp0
PRINT 'Response body:'
EXEC sp_OAMethod @sbJson, 'GetAsString', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @oauth2
EXEC @hr = sp_OADestroy @sbJson
RETURN
END
DECLARE @json int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @json OUT
EXEC sp_OAMethod @json, 'LoadSb', @success OUT, STR(@sbJson)
-- The following code parses the JSON response.
-- A sample JSON response is shown below the sample code.
DECLARE @kind nvarchar(4000)
DECLARE @etag nvarchar(4000)
DECLARE @summary nvarchar(4000)
DECLARE @updated nvarchar(4000)
DECLARE @timeZone nvarchar(4000)
DECLARE @accessRole nvarchar(4000)
DECLARE @nextSyncToken nvarchar(4000)
DECLARE @i int
DECLARE @count_i int
DECLARE @method nvarchar(4000)
DECLARE @minutes int
DECLARE @id nvarchar(4000)
DECLARE @status nvarchar(4000)
DECLARE @htmlLink nvarchar(4000)
DECLARE @created nvarchar(4000)
DECLARE @creatorEmail nvarchar(4000)
DECLARE @creatorSelf int
DECLARE @organizerEmail nvarchar(4000)
DECLARE @organizerSelf int
DECLARE @startDateTime nvarchar(4000)
DECLARE @endDateTime nvarchar(4000)
DECLARE @iCalUID nvarchar(4000)
DECLARE @sequence int
DECLARE @hangoutLink nvarchar(4000)
DECLARE @remindersUseDefault int
DECLARE @location nvarchar(4000)
EXEC sp_OAMethod @json, 'StringOf', @kind OUT, 'kind'
EXEC sp_OAMethod @json, 'StringOf', @etag OUT, 'etag'
EXEC sp_OAMethod @json, 'StringOf', @summary OUT, 'summary'
EXEC sp_OAMethod @json, 'StringOf', @updated OUT, 'updated'
EXEC sp_OAMethod @json, 'StringOf', @timeZone OUT, 'timeZone'
EXEC sp_OAMethod @json, 'StringOf', @accessRole OUT, 'accessRole'
EXEC sp_OAMethod @json, 'StringOf', @nextSyncToken OUT, 'nextSyncToken'
SELECT @i = 0
EXEC sp_OAMethod @json, 'SizeOfArray', @count_i OUT, 'defaultReminders'
WHILE STR(@i) < STR(@count_i)
BEGIN
EXEC sp_OASetProperty @json, 'I', STR(@i)
EXEC sp_OAMethod @json, 'StringOf', @method OUT, 'defaultReminders[i].method'
EXEC sp_OAMethod @json, 'IntOf', @minutes OUT, 'defaultReminders[i].minutes'
SELECT @i = STR(@i) + 1
END
SELECT @i = 0
EXEC sp_OAMethod @json, 'SizeOfArray', @count_i OUT, 'items'
WHILE STR(@i) < STR(@count_i)
BEGIN
EXEC sp_OASetProperty @json, 'I', STR(@i)
EXEC sp_OAMethod @json, 'StringOf', @kind OUT, 'items[i].kind'
EXEC sp_OAMethod @json, 'StringOf', @etag OUT, 'items[i].etag'
EXEC sp_OAMethod @json, 'StringOf', @id OUT, 'items[i].id'
EXEC sp_OAMethod @json, 'StringOf', @status OUT, 'items[i].status'
EXEC sp_OAMethod @json, 'StringOf', @htmlLink OUT, 'items[i].htmlLink'
EXEC sp_OAMethod @json, 'StringOf', @created OUT, 'items[i].created'
EXEC sp_OAMethod @json, 'StringOf', @updated OUT, 'items[i].updated'
EXEC sp_OAMethod @json, 'StringOf', @summary OUT, 'items[i].summary'
EXEC sp_OAMethod @json, 'StringOf', @creatorEmail OUT, 'items[i].creator.email'
EXEC sp_OAMethod @json, 'BoolOf', @creatorSelf OUT, 'items[i].creator.self'
EXEC sp_OAMethod @json, 'StringOf', @organizerEmail OUT, 'items[i].organizer.email'
EXEC sp_OAMethod @json, 'BoolOf', @organizerSelf OUT, 'items[i].organizer.self'
EXEC sp_OAMethod @json, 'StringOf', @startDateTime OUT, 'items[i].start.dateTime'
EXEC sp_OAMethod @json, 'StringOf', @endDateTime OUT, 'items[i].end.dateTime'
EXEC sp_OAMethod @json, 'StringOf', @iCalUID OUT, 'items[i].iCalUID'
EXEC sp_OAMethod @json, 'IntOf', @sequence OUT, 'items[i].sequence'
EXEC sp_OAMethod @json, 'StringOf', @hangoutLink OUT, 'items[i].hangoutLink'
EXEC sp_OAMethod @json, 'BoolOf', @remindersUseDefault OUT, 'items[i].reminders.useDefault'
EXEC sp_OAMethod @json, 'StringOf', @location OUT, 'items[i].location'
SELECT @i = STR(@i) + 1
END
PRINT 'Example Completed.'
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @oauth2
EXEC @hr = sp_OADestroy @sbJson
EXEC @hr = sp_OADestroy @json
END
GO
{
"kind": "calendar#events",
"etag": "\"p32gd13choqmte0g\"",
"summary": "support@chilkatcloud.com",
"updated": "2017-11-07T22:49:27.892Z",
"timeZone": "America/Chicago",
"accessRole": "owner",
"defaultReminders": [
{
"method": "popup",
"minutes": 10
}
],
"nextSyncToken": "CKDQjZHGrdcCEKDQjZHGrdcCGAU=",
"items": [
{
"kind": "calendar#event",
"etag": "\"3004746854620000\"",
"id": "5jt9fopfg3rr9eftegiuq7gc5k",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NWp0OWZvcGZnM3JyOWVmdGVnaXVxN2djNWsgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-10T13:57:07.000Z",
"updated": "2017-08-10T13:57:07.310Z",
"summary": "Run 10 miles",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-10T12:00:00-05:00"
},
"end": {
"dateTime": "2017-08-10T13:00:00-05:00"
},
"iCalUID": "5jt9fopfg3rr9eftegiuq7gc5k@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.5jt9fopfg3rr9eftegiuq7gc5k",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004746898118000\"",
"id": "7dvh49vd219r3sq7jdueieu8rc",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=N2R2aDQ5dmQyMTlyM3NxN2pkdWVpZXU4cmMgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-10T13:57:29.000Z",
"updated": "2017-08-10T13:57:29.059Z",
"summary": "Eat Giordano's Pizza",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-10T15:00:00-05:00"
},
"end": {
"dateTime": "2017-08-10T16:00:00-05:00"
},
"iCalUID": "7dvh49vd219r3sq7jdueieu8rc@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.7dvh49vd219r3sq7jdueieu8rc",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004746915224000\"",
"id": "5btd89ljn07bg3tlgpimcaqrro",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NWJ0ZDg5bGpuMDdiZzN0bGdwaW1jYXFycm8gc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-10T13:57:37.000Z",
"updated": "2017-08-10T13:57:37.612Z",
"summary": "Nap",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-10T16:30:00-05:00"
},
"end": {
"dateTime": "2017-08-10T17:30:00-05:00"
},
"iCalUID": "5btd89ljn07bg3tlgpimcaqrro@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.5btd89ljn07bg3tlgpimcaqrro",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004915127736000\"",
"id": "703fss5qdedn1egq80ildhslba",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NzAzZnNzNXFkZWRuMWVncTgwaWxkaHNsYmEgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-11T13:19:23.000Z",
"updated": "2017-08-11T13:19:23.868Z",
"summary": "Run 12 miles",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-12T09:30:00-05:00"
},
"end": {
"dateTime": "2017-08-12T10:30:00-05:00"
},
"iCalUID": "703fss5qdedn1egq80ildhslba@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.703fss5qdedn1egq80ildhslba",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004915160212000\"",
"id": "02pv1cpdp7vm11htnfi3ii7iie",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MDJwdjFjcGRwN3ZtMTFodG5maTNpaTdpaWUgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-11T13:19:40.000Z",
"updated": "2017-08-11T13:19:40.106Z",
"summary": "Eat Lou Malnati's Pizza",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-12T12:00:00-05:00"
},
"end": {
"dateTime": "2017-08-12T13:00:00-05:00"
},
"iCalUID": "02pv1cpdp7vm11htnfi3ii7iie@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.02pv1cpdp7vm11htnfi3ii7iie",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004915175982000\"",
"id": "20l29s2idr5ggorncd3teahm0e",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MjBsMjlzMmlkcjVnZ29ybmNkM3RlYWhtMGUgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-11T13:19:47.000Z",
"updated": "2017-08-11T13:19:47.991Z",
"summary": "Nap",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-12T16:30:00-05:00"
},
"end": {
"dateTime": "2017-08-12T17:30:00-05:00"
},
"iCalUID": "20l29s2idr5ggorncd3teahm0e@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.20l29s2idr5ggorncd3teahm0e",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3004969011208000\"",
"id": "v7kvmsvsoms3hjl5uq423jqhb0",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=djdrdm1zdnNvbXMzaGpsNXVxNDIzanFoYjAgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-08-11T20:48:25.000Z",
"updated": "2017-08-11T20:48:25.604Z",
"summary": "Eat Lou Malnati's Pizza",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-08-12T12:00:00-05:00"
},
"end": {
"dateTime": "2017-08-12T13:00:00-05:00"
},
"iCalUID": "v7kvmsvsoms3hjl5uq423jqhb0@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.v7kvmsvsoms3hjl5uq423jqhb0",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007268672000\"",
"id": "1p7fb5vob7vm57fepk4p1teft9",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MXA3ZmI1dm9iN3ZtNTdmZXBrNHAxdGVmdDkgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:27:14.000Z",
"updated": "2017-11-06T21:27:14.336Z",
"summary": "Breakfast at Tiffany's",
"location": "Tiffany's",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-06T07:00:00-06:00"
},
"end": {
"dateTime": "2017-11-06T08:00:00-06:00"
},
"iCalUID": "1p7fb5vob7vm57fepk4p1teft9@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.1p7fb5vob7vm57fepk4p1teft9",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007309018000\"",
"id": "05f5eieun35hoofbiab00ru03o",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MDVmNWVpZXVuMzVob29mYmlhYjAwcnUwM28gc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:27:34.000Z",
"updated": "2017-11-06T21:27:34.509Z",
"summary": "Lunch at Sushi House",
"location": "Sushi House",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-06T12:30:00-06:00"
},
"end": {
"dateTime": "2017-11-06T13:30:00-06:00"
},
"iCalUID": "05f5eieun35hoofbiab00ru03o@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.05f5eieun35hoofbiab00ru03o",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007516220000\"",
"id": "4hrv7chnc3jspepqr4ntrsq6k9",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NGhydjdjaG5jM2pzcGVwcXI0bnRyc3E2azkgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:29:17.000Z",
"updated": "2017-11-06T21:29:18.110Z",
"summary": "Dinner at Gia Mia",
"location": "Gia Mia",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-06T19:00:00-06:00"
},
"end": {
"dateTime": "2017-11-06T20:00:00-06:00"
},
"iCalUID": "4hrv7chnc3jspepqr4ntrsq6k9@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.4hrv7chnc3jspepqr4ntrsq6k9",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007580384000\"",
"id": "53k665tdurv5geejkl8d9eljmp",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NTNrNjY1dGR1cnY1Z2VlamtsOGQ5ZWxqbXAgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:29:50.000Z",
"updated": "2017-11-06T21:29:50.192Z",
"summary": "Breakfast at McDonald's",
"location": "McDonald's",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-09T07:00:00-06:00"
},
"end": {
"dateTime": "2017-11-09T08:00:00-06:00"
},
"iCalUID": "53k665tdurv5geejkl8d9eljmp@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.53k665tdurv5geejkl8d9eljmp",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007628078000\"",
"id": "27n9mbbabkur965n87ddir6m1i",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=MjduOW1iYmFia3VyOTY1bjg3ZGRpcjZtMWkgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:30:14.000Z",
"updated": "2017-11-06T21:30:14.039Z",
"summary": "Lunch at McDonald's",
"location": "McDonald's",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-09T13:00:00-06:00"
},
"end": {
"dateTime": "2017-11-09T14:00:00-06:00"
},
"iCalUID": "27n9mbbabkur965n87ddir6m1i@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.27n9mbbabkur965n87ddir6m1i",
"reminders": {
"useDefault": true
}
},
{
"kind": "calendar#event",
"etag": "\"3020007645098000\"",
"id": "3jmu86tk17hc21gam5l073pu1k",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=M2ptdTg2dGsxN2hjMjFnYW01bDA3M3B1MWsgc3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t",
"created": "2017-11-06T21:30:22.000Z",
"updated": "2017-11-06T21:30:22.549Z",
"summary": "Dinner at McDonald's",
"location": "McDonald's",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-09T19:00:00-06:00"
},
"end": {
"dateTime": "2017-11-09T20:00:00-06:00"
},
"iCalUID": "3jmu86tk17hc21gam5l073pu1k@google.com",
"sequence": 0,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.3jmu86tk17hc21gam5l073pu1k",
"reminders": {
"useDefault": true
}
}
]
}