Xbase++ Requires Chilkat v11.0.0+
Xbase++
MS Graph Calendar Update Event
See more Microsoft Calendar Examples
Update the properties of an event object.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL oJson
LOCAL oSbRequestBody
LOCAL oResp
LOCAL oSbResponseBody
LOCAL oJResp
LOCAL nRespStatusCode
LOCAL cOriginalStartTimeZone
LOCAL cOriginalEndTimeZone
LOCAL cResponseStatusResponse
LOCAL cResponseStatusTime
LOCAL cRecurrence
LOCAL cICalUId
LOCAL nReminderMinutesBeforeStart
LOCAL nIsOnlineMeeting
LOCAL cOnlineMeetingProvider
LOCAL nIsReminderOn
LOCAL cOnlineMeetingJoinUrl
LOCAL cOnlineMeetingConferenceId
LOCAL cOnlineMeetingTollNumber
nSuccess := 0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oHttp := CreateObject("Chilkat.Http")
// 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"
// ]
// }
oJson := CreateObject("Chilkat.JsonObject")
oJson:UpdateString("originalStartTimeZone", "originalStartTimeZone-value")
oJson:UpdateString("originalEndTimeZone", "originalEndTimeZone-value")
oJson:UpdateString("responseStatus.response", "")
oJson:UpdateString("responseStatus.time", "datetime-value")
oJson:UpdateNull("recurrence")
oJson:UpdateString("iCalUId", "iCalUId-value")
oJson:UpdateInt("reminderMinutesBeforeStart", 99)
oJson:UpdateBool("isOnlineMeeting", 1)
oJson:UpdateString("onlineMeetingProvider", "teamsForBusiness")
oJson:UpdateBool("isReminderOn", 1)
oJson:UpdateString("categories[0]", "Red category")
oHttp:SetRequestHeader("Content-type", "application/json")
oSbRequestBody := CreateObject("Chilkat.StringBuilder")
oJson:EmitSb(oSbRequestBody)
oResp := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpSb("PATCH", "https://graph.microsoft.com/v1.0/me/events/{id}", oSbRequestBody, "utf-8", "application/json", oResp)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oJson:destroy()
oSbRequestBody:destroy()
oResp:destroy()
RETURN
ENDIF
oSbResponseBody := CreateObject("Chilkat.StringBuilder")
oResp:GetBodySb(oSbResponseBody)
oJResp := CreateObject("Chilkat.JsonObject")
oJResp:LoadSb(oSbResponseBody)
oJResp:EmitCompact := 0
? "Response Body:"
? oJResp:Emit()
nRespStatusCode := oResp:StatusCode
? "Response Status Code = " + Str(nRespStatusCode)
IF (nRespStatusCode >= 400)
? "Response Header:"
? oResp:Header
? "Failed."
oHttp:destroy()
oJson:destroy()
oSbRequestBody:destroy()
oResp:destroy()
oSbResponseBody:destroy()
oJResp:destroy()
RETURN
ENDIF
// 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
cOriginalStartTimeZone := oJResp:StringOf("originalStartTimeZone")
cOriginalEndTimeZone := oJResp:StringOf("originalEndTimeZone")
cResponseStatusResponse := oJResp:StringOf("responseStatus.response")
cResponseStatusTime := oJResp:StringOf("responseStatus.time")
cRecurrence := oJResp:StringOf("recurrence")
cICalUId := oJResp:StringOf("iCalUId")
nReminderMinutesBeforeStart := oJResp:IntOf("reminderMinutesBeforeStart")
nIsOnlineMeeting := oJResp:BoolOf("isOnlineMeeting")
cOnlineMeetingProvider := oJResp:StringOf("onlineMeetingProvider")
nIsReminderOn := oJResp:BoolOf("isReminderOn")
cOnlineMeetingJoinUrl := oJResp:StringOf("onlineMeeting.joinUrl")
cOnlineMeetingConferenceId := oJResp:StringOf("onlineMeeting.conferenceId")
cOnlineMeetingTollNumber := oJResp:StringOf("onlineMeeting.tollNumber")
oHttp:destroy()
oJson:destroy()
oSbRequestBody:destroy()
oResp:destroy()
oSbResponseBody:destroy()
oJResp:destroy()