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) MS Graph Calendar Update EventUpdate the properties of an event object. For more information, see https://docs.microsoft.com/en-us/graph/api/event-update?view=graph-rest-1.0&tabs=http
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int DECLARE @iTmp0 int -- Important: Do not use nvarchar(max). See the warning about using nvarchar(max). DECLARE @sTmp0 nvarchar(4000) -- This example assumes the Chilkat API to have been previously unlocked. -- See Global Unlock Sample for sample code. DECLARE @http int -- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @success int -- Implements the following CURL command: -- curl -X PATCH https://graph.microsoft.com/v1.0/me/events/{id} \ -- -H "Content-type: application/json" \ -- -d '{ -- "originalStartTimeZone": "originalStartTimeZone-value", -- "originalEndTimeZone": "originalEndTimeZone-value", -- "responseStatus": { -- "response": "", -- "time": "datetime-value" -- }, -- "recurrence": null, -- "iCalUId": "iCalUId-value", -- "reminderMinutesBeforeStart": 99, -- "isOnlineMeeting": true, -- "onlineMeetingProvider": "teamsForBusiness", -- "isReminderOn": true, -- "categories": ["Red category"] -- }' -- Use the following online tool to generate HTTP code from a CURL command -- Convert a cURL Command to HTTP Source Code -- Use this online tool to generate code from sample JSON: -- Generate Code to Create JSON -- The following JSON is sent in the request body. -- { -- "originalStartTimeZone": "originalStartTimeZone-value", -- "originalEndTimeZone": "originalEndTimeZone-value", -- "responseStatus": { -- "response": "", -- "time": "datetime-value" -- }, -- "recurrence": null, -- "iCalUId": "iCalUId-value", -- "reminderMinutesBeforeStart": 99, -- "isOnlineMeeting": true, -- "onlineMeetingProvider": "teamsForBusiness", -- "isReminderOn": true, -- "categories": [ -- "Red category" -- ] -- } DECLARE @json int -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'originalStartTimeZone', 'originalStartTimeZone-value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'originalEndTimeZone', 'originalEndTimeZone-value' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'responseStatus.response', '' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'responseStatus.time', 'datetime-value' EXEC sp_OAMethod @json, 'UpdateNull', @success OUT, 'recurrence' EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'iCalUId', 'iCalUId-value' EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'reminderMinutesBeforeStart', 99 EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'isOnlineMeeting', 1 EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'onlineMeetingProvider', 'teamsForBusiness' EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'isReminderOn', 1 EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'categories[0]', 'Red category' EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Content-type', 'application/json' DECLARE @sbRequestBody int -- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbRequestBody OUT EXEC sp_OAMethod @json, 'EmitSb', @success OUT, @sbRequestBody DECLARE @resp int EXEC sp_OAMethod @http, 'PTextSb', @resp OUT, 'PATCH', 'https://graph.microsoft.com/v1.0/me/events/{id}', @sbRequestBody, 'utf-8', 'application/json', 0, 0 EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT IF @iTmp0 = 0 BEGIN EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @json EXEC @hr = sp_OADestroy @sbRequestBody RETURN END DECLARE @sbResponseBody int -- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody DECLARE @jResp int -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody EXEC sp_OASetProperty @jResp, 'EmitCompact', 0 PRINT 'Response Body:' EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT PRINT @sTmp0 DECLARE @respStatusCode int EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT PRINT 'Response Status Code = ' + @respStatusCode IF @respStatusCode >= 400 BEGIN PRINT 'Response Header:' EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT PRINT @sTmp0 PRINT 'Failed.' EXEC @hr = sp_OADestroy @resp EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @json EXEC @hr = sp_OADestroy @sbRequestBody EXEC @hr = sp_OADestroy @sbResponseBody EXEC @hr = sp_OADestroy @jResp RETURN END EXEC @hr = sp_OADestroy @resp -- Sample JSON response: -- (Sample code for parsing the JSON response is shown below) -- { -- "originalStartTimeZone": "originalStartTimeZone-value", -- "originalEndTimeZone": "originalEndTimeZone-value", -- "responseStatus": { -- "response": "", -- "time": "datetime-value" -- }, -- "recurrence": null, -- "iCalUId": "iCalUId-value", -- "reminderMinutesBeforeStart": 99, -- "isOnlineMeeting": true, -- "onlineMeetingProvider": "teamsForBusiness", -- "isReminderOn": true, -- "onlineMeeting": { -- "joinUrl": "https://teams.microsoft.com/l/meetup-join/19%3ameeting_NzIyNzhlMGEtM2YyZC00ZmY0LTlhNzUtZmZjNWFmZGNlNzE2%40thread.v2/0?context=%7b%22Tid%22%3a%2272f988bf-86f1-41af-91ab-2d7cd011db47%22%2c%22Oid%22%3a%22bc55b173-cff6-457d-b7a1-64bda7d7581a%22%7d", -- "conferenceId": "177513992", -- "tollNumber": "+91 22 6241 6885" -- } -- } -- Sample code for parsing the JSON response... -- Use the following online tool to generate parsing code from sample JSON: -- Generate Parsing Code from JSON DECLARE @originalStartTimeZone nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @originalStartTimeZone OUT, 'originalStartTimeZone' DECLARE @originalEndTimeZone nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @originalEndTimeZone OUT, 'originalEndTimeZone' DECLARE @responseStatusResponse nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @responseStatusResponse OUT, 'responseStatus.response' DECLARE @responseStatusTime nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @responseStatusTime OUT, 'responseStatus.time' DECLARE @recurrence nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @recurrence OUT, 'recurrence' DECLARE @iCalUId nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @iCalUId OUT, 'iCalUId' DECLARE @reminderMinutesBeforeStart int EXEC sp_OAMethod @jResp, 'IntOf', @reminderMinutesBeforeStart OUT, 'reminderMinutesBeforeStart' DECLARE @isOnlineMeeting int EXEC sp_OAMethod @jResp, 'BoolOf', @isOnlineMeeting OUT, 'isOnlineMeeting' DECLARE @onlineMeetingProvider nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @onlineMeetingProvider OUT, 'onlineMeetingProvider' DECLARE @isReminderOn int EXEC sp_OAMethod @jResp, 'BoolOf', @isReminderOn OUT, 'isReminderOn' DECLARE @onlineMeetingJoinUrl nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @onlineMeetingJoinUrl OUT, 'onlineMeeting.joinUrl' DECLARE @onlineMeetingConferenceId nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @onlineMeetingConferenceId OUT, 'onlineMeeting.conferenceId' DECLARE @onlineMeetingTollNumber nvarchar(4000) EXEC sp_OAMethod @jResp, 'StringOf', @onlineMeetingTollNumber OUT, 'onlineMeeting.tollNumber' EXEC @hr = sp_OADestroy @http EXEC @hr = sp_OADestroy @json EXEC @hr = sp_OADestroy @sbRequestBody EXEC @hr = sp_OADestroy @sbResponseBody EXEC @hr = sp_OADestroy @jResp END GO |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.