AutoIt
AutoIt
MS Graph Calendar Update Event
See more Microsoft Calendar Examples
Update the properties of an event object.Chilkat AutoIt Downloads
Local $bSuccess = False
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("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 = ObjCreate("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",True)
$oJson.UpdateString("onlineMeetingProvider","teamsForBusiness")
$oJson.UpdateBool("isReminderOn",True)
$oJson.UpdateString("categories[0]","Red category")
$oHttp.SetRequestHeader "Content-type","application/json"
$oSbRequestBody = ObjCreate("Chilkat.StringBuilder")
$oJson.EmitSb($oSbRequestBody)
$oResp = ObjCreate("Chilkat.HttpResponse")
$bSuccess = $oHttp.HttpSb("PATCH","https://graph.microsoft.com/v1.0/me/events/{id}",$oSbRequestBody,"utf-8","application/json",$oResp)
If ($bSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$oResp.GetBodySb($oSbResponseBody)
$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False
ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)
Local $iRespStatusCode = $oResp.StatusCode
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
ConsoleWrite("Response Header:" & @CRLF)
ConsoleWrite($oResp.Header & @CRLF)
ConsoleWrite("Failed." & @CRLF)
Exit
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
Local $sOriginalStartTimeZone = $oJResp.StringOf("originalStartTimeZone")
Local $sOriginalEndTimeZone = $oJResp.StringOf("originalEndTimeZone")
Local $sResponseStatusResponse = $oJResp.StringOf("responseStatus.response")
Local $sResponseStatusTime = $oJResp.StringOf("responseStatus.time")
Local $sRecurrence = $oJResp.StringOf("recurrence")
Local $sICalUId = $oJResp.StringOf("iCalUId")
Local $iReminderMinutesBeforeStart = $oJResp.IntOf("reminderMinutesBeforeStart")
Local $bIsOnlineMeeting = $oJResp.BoolOf("isOnlineMeeting")
Local $sOnlineMeetingProvider = $oJResp.StringOf("onlineMeetingProvider")
Local $bIsReminderOn = $oJResp.BoolOf("isReminderOn")
Local $sOnlineMeetingJoinUrl = $oJResp.StringOf("onlineMeeting.joinUrl")
Local $sOnlineMeetingConferenceId = $oJResp.StringOf("onlineMeeting.conferenceId")
Local $sOnlineMeetingTollNumber = $oJResp.StringOf("onlineMeeting.tollNumber")