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
(PowerBuilder) MS Graph Calendar List EventsRetrieve a list of events in a calendar. The list contains single instance meetings and series masters. For more details, see https://docs.microsoft.com/en-us/graph/api/calendar-list-events?view=graph-rest-1.0
integer li_rc oleobject loo_Http oleobject loo_JsonToken integer li_Success string ls_StrResponse oleobject loo_Json string ls_OdataContext integer i integer li_Count_i string ls_OdataEtag string ls_Id string ls_CreatedDateTime string ls_LastModifiedDateTime string ls_ChangeKey string ls_OriginalStartTimeZone string ls_OriginalEndTimeZone string ls_ICalUId integer li_ReminderMinutesBeforeStart integer li_IsReminderOn integer li_HasAttachments string ls_Subject string ls_BodyPreview string ls_Importance string ls_Sensitivity integer li_IsAllDay integer li_IsCancelled integer li_IsOrganizer integer li_ResponseRequested string ls_SeriesMasterId string ls_ShowAs string ls_V_type string ls_WebLink string ls_OnlineMeetingUrl string ls_Recurrence string ls_ResponseStatusResponse string ls_ResponseStatusTime string ls_BodyContentType string ls_BodyContent string ls_StartDateTime string ls_StartTimeZone string ls_EndDateTime string ls_EndTimeZone string ls_LocationDisplayName string ls_LocationLocationType string ls_LocationUniqueId string ls_LocationUniqueIdType string ls_OrganizerEmailAddressName string ls_OrganizerEmailAddressAddress integer j integer li_Count_j string ls_DisplayName string ls_LocationType string ls_UniqueId string ls_UniqueIdType string ls_StatusResponse string ls_StatusTime string ls_EmailAddressName string ls_EmailAddressAddress // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if // Use your previously obtained access token as shown here: // Get Microsoft Graph OAuth2 Access Token with Calendars.ReadWrite scope. loo_JsonToken = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_JsonToken.ConnectToNewObject("Chilkat.JsonObject") li_Success = loo_JsonToken.LoadFile("qa_data/tokens/msGraphCalendar.json") if li_Success = 0 then Write-Debug loo_JsonToken.LastErrorText destroy loo_Http destroy loo_JsonToken return end if loo_Http.AuthToken = loo_JsonToken.StringOf("access_token") // Specify the calendar id loo_Http.SetUrlVar("id","AQMkADAwATM0MDAAMS1iNTcwLWI2NTEtMDACLTAwCgBGAAADsVyfxjDU406Ic4X7ill8xAcA5_vF7TKKdE6bGCRqXyl2PQAAAgEGAAAA5_vF7TKKdE6bGCRqXyl2PQAClEpRTgAAAA==") // Send a GET request to https://graph.microsoft.com/v1.0/me/calendars/{$id}/events ls_StrResponse = loo_Http.QuickGetStr("https://graph.microsoft.com/v1.0/me/calendars/{$id}/events") if loo_Http.LastMethodSuccess = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_JsonToken return end if loo_Json = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") loo_Json.Load(ls_StrResponse) loo_Json.EmitCompact = 0 if loo_Http.LastStatus <> 200 then Write-Debug loo_Json.Emit() Write-Debug "Failed, response status code = " + string(loo_Http.LastStatus) destroy loo_Http destroy loo_JsonToken destroy loo_Json return end if Write-Debug loo_Json.Emit() // Sample output: // (See parsing code below..) // { // "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('admin%40chilkat.io')/calendars('AQMkADAwATM0MDAAMS1i ... AClEpRTgAAAA%3D%3D')/events", // "value": [ // { // "@odata.etag": "W/\"5+vF7TKKdE6bGCRqXyl2PQAClIgmmw==\"", // "id": "AQMkADAwATM0MDAAM ... AApRZ7JkAAAA=", // "createdDateTime": "2019-04-26T14:31:39.8791929Z", // "lastModifiedDateTime": "2019-04-26T14:31:41.2753537Z", // "changeKey": "5+vF7TKKdE6bGCRqXyl2PQAClIgmmw==", // "categories": [ // ], // "originalStartTimeZone": "Pacific Standard Time", // "originalEndTimeZone": "Pacific Standard Time", // "iCalUId": "040000008200E ... A230FEBFE5F7486A", // "reminderMinutesBeforeStart": 15, // "isReminderOn": true, // "hasAttachments": false, // "subject": "Let's go for lunch", // "bodyPreview": "Does mid month work for you?", // "importance": "normal", // "sensitivity": "normal", // "isAllDay": false, // "isCancelled": false, // "isOrganizer": true, // "responseRequested": true, // "seriesMasterId": null, // "showAs": "busy", // "type": "singleInstance", // "webLink": "https://outlook.live.com/owa/?itemid=AQMkADAwATM0MDAAMS1iNTcwLWI2NT ... gkal8pdj0AApRZ7JkAAAA%3D&exvsurl=1&path=/calendar/item", // "onlineMeetingUrl": null, // "recurrence": null, // "responseStatus": { // "response": "organizer", // "time": "0001-01-01T00:00:00Z" // }, // "body": { // "contentType": "html", // "content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\nDoes mid month work for you?\r\n</body>\r\n</html>\r\n" // }, // "start": { // "dateTime": "2019-11-15T20:00:00.0000000", // "timeZone": "UTC" // }, // "end": { // "dateTime": "2019-11-15T22:00:00.0000000", // "timeZone": "UTC" // }, // "location": { // "displayName": "Harry's Bar", // "locationType": "default", // "uniqueId": "Harry's Bar", // "uniqueIdType": "private" // }, // "locations": [ // { // "displayName": "Harry's Bar", // "locationType": "default", // "uniqueId": "Harry's Bar", // "uniqueIdType": "private" // } // ], // "attendees": [ // { // "type": "required", // "status": { // "response": "none", // "time": "0001-01-01T00:00:00Z" // }, // "emailAddress": { // "name": "Adele Vance", // "address": "adelev@contoso.onmicrosoft.com" // } // } // ], // "organizer": { // "emailAddress": { // "name": "Matt", // "address": "outlook_3A33FCEB9B74CC15@outlook.com" // } // } // } // ] // } // Use this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON ls_OdataContext = loo_Json.StringOf("~"@odata.context~"") i = 0 li_Count_i = loo_Json.SizeOfArray("value") do while i < li_Count_i loo_Json.I = i ls_OdataEtag = loo_Json.StringOf("value[i].~"@odata.etag~"") ls_Id = loo_Json.StringOf("value[i].id") ls_CreatedDateTime = loo_Json.StringOf("value[i].createdDateTime") ls_LastModifiedDateTime = loo_Json.StringOf("value[i].lastModifiedDateTime") ls_ChangeKey = loo_Json.StringOf("value[i].changeKey") ls_OriginalStartTimeZone = loo_Json.StringOf("value[i].originalStartTimeZone") ls_OriginalEndTimeZone = loo_Json.StringOf("value[i].originalEndTimeZone") ls_ICalUId = loo_Json.StringOf("value[i].iCalUId") li_ReminderMinutesBeforeStart = loo_Json.IntOf("value[i].reminderMinutesBeforeStart") li_IsReminderOn = loo_Json.BoolOf("value[i].isReminderOn") li_HasAttachments = loo_Json.BoolOf("value[i].hasAttachments") ls_Subject = loo_Json.StringOf("value[i].subject") ls_BodyPreview = loo_Json.StringOf("value[i].bodyPreview") ls_Importance = loo_Json.StringOf("value[i].importance") ls_Sensitivity = loo_Json.StringOf("value[i].sensitivity") li_IsAllDay = loo_Json.BoolOf("value[i].isAllDay") li_IsCancelled = loo_Json.BoolOf("value[i].isCancelled") li_IsOrganizer = loo_Json.BoolOf("value[i].isOrganizer") li_ResponseRequested = loo_Json.BoolOf("value[i].responseRequested") ls_SeriesMasterId = loo_Json.StringOf("value[i].seriesMasterId") ls_ShowAs = loo_Json.StringOf("value[i].showAs") ls_V_type = loo_Json.StringOf("value[i].type") ls_WebLink = loo_Json.StringOf("value[i].webLink") ls_OnlineMeetingUrl = loo_Json.StringOf("value[i].onlineMeetingUrl") ls_Recurrence = loo_Json.StringOf("value[i].recurrence") ls_ResponseStatusResponse = loo_Json.StringOf("value[i].responseStatus.response") ls_ResponseStatusTime = loo_Json.StringOf("value[i].responseStatus.time") ls_BodyContentType = loo_Json.StringOf("value[i].body.contentType") ls_BodyContent = loo_Json.StringOf("value[i].body.content") ls_StartDateTime = loo_Json.StringOf("value[i].start.dateTime") ls_StartTimeZone = loo_Json.StringOf("value[i].start.timeZone") ls_EndDateTime = loo_Json.StringOf("value[i].end.dateTime") ls_EndTimeZone = loo_Json.StringOf("value[i].end.timeZone") ls_LocationDisplayName = loo_Json.StringOf("value[i].location.displayName") ls_LocationLocationType = loo_Json.StringOf("value[i].location.locationType") ls_LocationUniqueId = loo_Json.StringOf("value[i].location.uniqueId") ls_LocationUniqueIdType = loo_Json.StringOf("value[i].location.uniqueIdType") ls_OrganizerEmailAddressName = loo_Json.StringOf("value[i].organizer.emailAddress.name") ls_OrganizerEmailAddressAddress = loo_Json.StringOf("value[i].organizer.emailAddress.address") j = 0 li_Count_j = loo_Json.SizeOfArray("value[i].categories") do while j < li_Count_j loo_Json.J = j // ... j = j + 1 loop j = 0 li_Count_j = loo_Json.SizeOfArray("value[i].locations") do while j < li_Count_j loo_Json.J = j ls_DisplayName = loo_Json.StringOf("value[i].locations[j].displayName") ls_LocationType = loo_Json.StringOf("value[i].locations[j].locationType") ls_UniqueId = loo_Json.StringOf("value[i].locations[j].uniqueId") ls_UniqueIdType = loo_Json.StringOf("value[i].locations[j].uniqueIdType") j = j + 1 loop j = 0 li_Count_j = loo_Json.SizeOfArray("value[i].attendees") do while j < li_Count_j loo_Json.J = j ls_V_type = loo_Json.StringOf("value[i].attendees[j].type") ls_StatusResponse = loo_Json.StringOf("value[i].attendees[j].status.response") ls_StatusTime = loo_Json.StringOf("value[i].attendees[j].status.time") ls_EmailAddressName = loo_Json.StringOf("value[i].attendees[j].emailAddress.name") ls_EmailAddressAddress = loo_Json.StringOf("value[i].attendees[j].emailAddress.address") j = j + 1 loop i = i + 1 loop Write-Debug "Success." destroy loo_Http destroy loo_JsonToken destroy loo_Json |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.