Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) Outlook Calendar List EventsSee more Outlook Calendar ExamplesRetrieve a list of events in a calendar. For more information, see https://docs.microsoft.com/en-us/graph/api/calendar-list-events?view=graph-rest-1.0&tabs=http
; This example requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oHttp = ObjCreate("Chilkat.Http") ; Use your previously obtained access token here: Get Outlook Calendar OAuth2 Access Token (Azure AD v2.0 Endpoint). $oJsonToken = ObjCreate("Chilkat.JsonObject") Local $bSuccess = $oJsonToken.LoadFile("qa_data/tokens/outlookCalendar.json") If ($bSuccess = False) Then ConsoleWrite($oJsonToken.LastErrorText & @CRLF) Exit EndIf $oHttp.AuthToken = $oJsonToken.StringOf("access_token") ; Specify the ID of the calendar to list. Local $sCalendarId = "AQMkADAwATM0MDAAMS1iNTcwLWI2NTEtMDACLTAwCgBGAAADsVyfxjDU406Ic4X7ill8xAcA5_vF7TKKdE6bGCRqXyl2PQAAAgEGAAAA5_vF7TKKdE6bGCRqXyl2PQAAAiCsAAAA" $oHttp.SetUrlVar("id",$sCalendarId) ; To list the events in the default calendar, use the following URL: https://graph.microsoft.com/v1.0/me/calendars/events Local $oResp = $oHttp.QuickRequest("GET","https://graph.microsoft.com/v1.0/me/calendars/{$id}/events") If ($oHttp.LastMethodSuccess <> True) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf ConsoleWrite("Response status code = " & $oResp.StatusCode & @CRLF) ; The HTTP request succeeded if the response status code = 200. If ($oResp.StatusCode <> 200) Then ConsoleWrite($oResp.BodyStr & @CRLF) ConsoleWrite("Failed" & @CRLF) Exit EndIf $oJson = ObjCreate("Chilkat.JsonObject") $oJson.Load($oResp.BodyStr) $oJson.EmitCompact = False ConsoleWrite($oJson.Emit() & @CRLF) ; Here is a sample response: ; Use this online tool to generate parsing code from sample JSON: ; Generate Parsing Code from JSON ; { ; "value": [ ; { ; "originalStartTimeZone": "originalStartTimeZone-value", ; "originalEndTimeZone": "originalEndTimeZone-value", ; "responseStatus": { ; "response": "", ; "time": "datetime-value" ; }, ; "iCalUId": "iCalUId-value", ; "reminderMinutesBeforeStart": 99, ; "isReminderOn": true ; } ; ] ; } Local $sOriginalStartTimeZone Local $sOriginalEndTimeZone Local $sResponseStatusResponse Local $sResponseStatusTime Local $sICalUId Local $iReminderMinutesBeforeStart Local $bIsReminderOn Local $i = 0 Local $iCount_i = $oJson.SizeOfArray("value") While $i < $iCount_i $oJson.I = $i $sOriginalStartTimeZone = $oJson.StringOf("value[i].originalStartTimeZone") $sOriginalEndTimeZone = $oJson.StringOf("value[i].originalEndTimeZone") $sResponseStatusResponse = $oJson.StringOf("value[i].responseStatus.response") $sResponseStatusTime = $oJson.StringOf("value[i].responseStatus.time") $sICalUId = $oJson.StringOf("value[i].iCalUId") $iReminderMinutesBeforeStart = $oJson.IntOf("value[i].reminderMinutesBeforeStart") $bIsReminderOn = $oJson.BoolOf("value[i].isReminderOn") $i = $i + 1 Wend |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.