Returns instances of the specified recurring event.
This example gets instances for an event from the calendar having the ID = "support@chilkatcloud.com", where the event ID equals "6li3bfqqq65edprt4ms6vdld2j"
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/6li3bfqqq65edprt4ms6vdld2j/instances', 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 @description nvarchar(4000)
DECLARE @location nvarchar(4000)
DECLARE @creatorEmail nvarchar(4000)
DECLARE @creatorSelf int
DECLARE @organizerEmail nvarchar(4000)
DECLARE @organizerSelf int
DECLARE @startDateTime nvarchar(4000)
DECLARE @startTimeZone nvarchar(4000)
DECLARE @endDateTime nvarchar(4000)
DECLARE @endTimeZone nvarchar(4000)
DECLARE @recurringEventId nvarchar(4000)
DECLARE @originalStartTimeDateTime nvarchar(4000)
DECLARE @originalStartTimeTimeZone nvarchar(4000)
DECLARE @iCalUID nvarchar(4000)
DECLARE @sequence int
DECLARE @hangoutLink nvarchar(4000)
DECLARE @remindersUseDefault int
DECLARE @j int
DECLARE @count_j int
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', @description OUT, 'items[i].description'
EXEC sp_OAMethod @json, 'StringOf', @location OUT, 'items[i].location'
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', @startTimeZone OUT, 'items[i].start.timeZone'
EXEC sp_OAMethod @json, 'StringOf', @endDateTime OUT, 'items[i].end.dateTime'
EXEC sp_OAMethod @json, 'StringOf', @endTimeZone OUT, 'items[i].end.timeZone'
EXEC sp_OAMethod @json, 'StringOf', @recurringEventId OUT, 'items[i].recurringEventId'
EXEC sp_OAMethod @json, 'StringOf', @originalStartTimeDateTime OUT, 'items[i].originalStartTime.dateTime'
EXEC sp_OAMethod @json, 'StringOf', @originalStartTimeTimeZone OUT, 'items[i].originalStartTime.timeZone'
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'
SELECT @j = 0
EXEC sp_OAMethod @json, 'SizeOfArray', @count_j OUT, 'items[i].reminders.overrides'
WHILE STR(@j) < STR(@count_j)
BEGIN
EXEC sp_OASetProperty @json, 'J', STR(@j)
EXEC sp_OAMethod @json, 'StringOf', @method OUT, 'items[i].reminders.overrides[j].method'
EXEC sp_OAMethod @json, 'IntOf', @minutes OUT, 'items[i].reminders.overrides[j].minutes'
SELECT @j = STR(@j) + 1
END
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": "\"p33se7k7armnte0g\"",
"summary": "support@chilkatcloud.com",
"updated": "2017-11-08T19:40:49.131Z",
"timeZone": "America/Chicago",
"accessRole": "owner",
"defaultReminders": [
{
"method": "popup",
"minutes": 10
}
],
"nextSyncToken": "CPjj0Ordr9cCEPjj0Ordr9cCGAU=",
"items": [
{
"kind": "calendar#event",
"etag": "\"3020339874608000\"",
"id": "6li3bfqqq65edprt4ms6vdld2j_20171111T000000Z",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NmxpM2JmcXFxNjVlZHBydDRtczZ2ZGxkMmpfMjAxNzExMTFUMDAwMDAwWiBzdXBwb3J0QGNoaWxrYXRjbG91ZC5jb20",
"created": "2017-11-08T19:35:30.000Z",
"updated": "2017-11-08T19:40:49.019Z",
"summary": "TGIF Happy Hour",
"description": "Friday Night Happy Hour",
"location": "Shannon's Irish Pub, 428 N Main St, Glen Ellyn, IL 60137, USA",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-10T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"end": {
"dateTime": "2017-11-10T19:00:00-06:00",
"timeZone": "America/Chicago"
},
"recurringEventId": "6li3bfqqq65edprt4ms6vdld2j",
"originalStartTime": {
"dateTime": "2017-11-10T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"iCalUID": "6li3bfqqq65edprt4ms6vdld2j@google.com",
"sequence": 1,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.6li3bfqqq65edprt4ms6vdld2j",
"reminders": {
"useDefault": false,
"overrides": [
{
"method": "popup",
"minutes": 180
}
]
}
},
{
"kind": "calendar#event",
"etag": "\"3020339874608000\"",
"id": "6li3bfqqq65edprt4ms6vdld2j_20171118T000000Z",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NmxpM2JmcXFxNjVlZHBydDRtczZ2ZGxkMmpfMjAxNzExMThUMDAwMDAwWiBzdXBwb3J0QGNoaWxrYXRjbG91ZC5jb20",
"created": "2017-11-08T19:35:30.000Z",
"updated": "2017-11-08T19:40:49.019Z",
"summary": "TGIF Happy Hour",
"description": "Friday Night Happy Hour",
"location": "Shannon's Irish Pub, 428 N Main St, Glen Ellyn, IL 60137, USA",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-17T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"end": {
"dateTime": "2017-11-17T19:00:00-06:00",
"timeZone": "America/Chicago"
},
"recurringEventId": "6li3bfqqq65edprt4ms6vdld2j",
"originalStartTime": {
"dateTime": "2017-11-17T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"iCalUID": "6li3bfqqq65edprt4ms6vdld2j@google.com",
"sequence": 1,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.6li3bfqqq65edprt4ms6vdld2j",
"reminders": {
"useDefault": false,
"overrides": [
{
"method": "popup",
"minutes": 180
}
]
}
},
{
"kind": "calendar#event",
"etag": "\"3020339874608000\"",
"id": "6li3bfqqq65edprt4ms6vdld2j_20171125T000000Z",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NmxpM2JmcXFxNjVlZHBydDRtczZ2ZGxkMmpfMjAxNzExMjVUMDAwMDAwWiBzdXBwb3J0QGNoaWxrYXRjbG91ZC5jb20",
"created": "2017-11-08T19:35:30.000Z",
"updated": "2017-11-08T19:40:49.019Z",
"summary": "TGIF Happy Hour",
"description": "Friday Night Happy Hour",
"location": "Shannon's Irish Pub, 428 N Main St, Glen Ellyn, IL 60137, USA",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-11-24T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"end": {
"dateTime": "2017-11-24T19:00:00-06:00",
"timeZone": "America/Chicago"
},
"recurringEventId": "6li3bfqqq65edprt4ms6vdld2j",
"originalStartTime": {
"dateTime": "2017-11-24T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"iCalUID": "6li3bfqqq65edprt4ms6vdld2j@google.com",
"sequence": 1,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.6li3bfqqq65edprt4ms6vdld2j",
"reminders": {
"useDefault": false,
"overrides": [
{
"method": "popup",
"minutes": 180
}
]
}
},
{
"kind": "calendar#event",
"etag": "\"3020339874608000\"",
"id": "6li3bfqqq65edprt4ms6vdld2j_20171202T000000Z",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=NmxpM2JmcXFxNjVlZHBydDRtczZ2ZGxkMmpfMjAxNzEyMDJUMDAwMDAwWiBzdXBwb3J0QGNoaWxrYXRjbG91ZC5jb20",
"created": "2017-11-08T19:35:30.000Z",
"updated": "2017-11-08T19:40:49.019Z",
"summary": "TGIF Happy Hour",
"description": "Friday Night Happy Hour",
"location": "Shannon's Irish Pub, 428 N Main St, Glen Ellyn, IL 60137, USA",
"creator": {
"email": "support@chilkatcloud.com",
"self": true
},
"organizer": {
"email": "support@chilkatcloud.com",
"self": true
},
"start": {
"dateTime": "2017-12-01T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"end": {
"dateTime": "2017-12-01T19:00:00-06:00",
"timeZone": "America/Chicago"
},
"recurringEventId": "6li3bfqqq65edprt4ms6vdld2j",
"originalStartTime": {
"dateTime": "2017-12-01T18:00:00-06:00",
"timeZone": "America/Chicago"
},
"iCalUID": "6li3bfqqq65edprt4ms6vdld2j@google.com",
"sequence": 1,
"hangoutLink": "https://plus.google.com/hangouts/_/chilkatcloud.com/support?hceid=c3VwcG9ydEBjaGlsa2F0Y2xvdWQuY29t.6li3bfqqq65edprt4ms6vdld2j",
"reminders": {
"useDefault": false,
"overrides": [
{
"method": "popup",
"minutes": 180
}
]
}
}
]
}