Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

DataFlex Web API Examples

Primary Categories

AWS Translate
Activix CRM
Adyen
Amazon MWS
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bluzone
CardConnect
ClickBank
Clickatell
Cloudfare
DocuSign
ETrade
Etsy
Facebook
GeoOp
GetHarvest
Jira
MYOB

Magento
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Okta OAuth/OIDC
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
SOAP finkok.com
Shippo
Shopify
Stripe
SugarCRM
Trello
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
Xero
eBay
effectconnect

 

 

 

(DataFlex) MS Graph Calendar List Events

Retrieve 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

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
Token    Handle hoJsonToken
    Boolean iSuccess
    String sStrResponse
    Handle hoJson
    String sOdataContext
    Integer i
    Integer iCount_i
    String sOdataEtag
    String sId
    String sCreatedDateTime
    String sLastModifiedDateTime
    String sChangeKey
    String sOriginalStartTimeZone
    String sOriginalEndTimeZone
    String sICalUId
    Integer iReminderMinutesBeforeStart
    Boolean iIsReminderOn
    Boolean iHasAttachments
    String sSubject
    String sBodyPreview
    String sImportance
    String sSensitivity
    Boolean iIsAllDay
    Boolean iIsCancelled
    Boolean iIsOrganizer
    Boolean iResponseRequested
    String sSeriesMasterId
    String sShowAs
    String sV_type
    String sWebLink
    String sOnlineMeetingUrl
    String sRecurrence
    String sResponseStatusResponse
    String sResponseStatusTime
    String sBodyContentType
    String sBodyContent
    String sStartDateTime
    String sStartTimeZone
    String sEndDateTime
    String sEndTimeZone
    String sLocationDisplayName
    String sLocationLocationType
    String sLocationUniqueId
    String sLocationUniqueIdType
    String sOrganizerEmailAddressName
    String sOrganizerEmailAddressAddress
    Integer j
    Integer iCount_j
    String sDisplayName
    String sLocationType
    String sUniqueId
    String sUniqueIdType
    String sStatusResponse
    String sStatusTime
    String sEmailAddressName
    String sEmailAddressAddress
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // Use your previously obtained access token as shown here:
    //    Get Microsoft Graph OAuth2 Access Token with Calendars.ReadWrite scope.

    Get Create (RefClass(cComChilkatJsonObject)) To hoJsonToken
    If (Not(IsComObjectCreated(hoJsonToken))) Begin
        Send CreateComObject of hoJsonToken
    End
    Get ComLoadFile Of hoJsonToken "qa_data/tokens/msGraphCalendar.json" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoJsonToken To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComStringOf Of hoJsonToken "access_token" To sTemp1
    Set ComAuthToken Of hoHttp To sTemp1

    // Specify the calendar id
    Get ComSetUrlVar Of hoHttp "id" "AQMkADAwATM0MDAAMS1iNTcwLWI2NTEtMDACLTAwCgBGAAADsVyfxjDU406Ic4X7ill8xAcA5_vF7TKKdE6bGCRqXyl2PQAAAgEGAAAA5_vF7TKKdE6bGCRqXyl2PQAClEpRTgAAAA==" To iSuccess
    // Send a GET request to https://graph.microsoft.com/v1.0/me/calendars/{$id}/events
    Get ComQuickGetStr Of hoHttp "https://graph.microsoft.com/v1.0/me/calendars/{$id}/events" To sStrResponse
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJson
    If (Not(IsComObjectCreated(hoJson))) Begin
        Send CreateComObject of hoJson
    End
    Get ComLoad Of hoJson sStrResponse To iSuccess
    Set ComEmitCompact Of hoJson To False

    Get ComLastStatus Of hoHttp To iTemp1
    If (iTemp1 <> 200) Begin
        Get ComEmit Of hoJson To sTemp1
        Showln sTemp1
        Get ComLastStatus Of hoHttp To iTemp1
        Showln "Failed, response status code = " iTemp1
        Procedure_Return
    End

    Get ComEmit Of hoJson To sTemp1
    Showln sTemp1

    // 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

    Get ComStringOf Of hoJson '"@odata.context"' To sOdataContext
    Move 0 To i
    Get ComSizeOfArray Of hoJson "value" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJson To i
        Get ComStringOf Of hoJson 'value[i]."@odata.etag"' To sOdataEtag
        Get ComStringOf Of hoJson "value[i].id" To sId
        Get ComStringOf Of hoJson "value[i].createdDateTime" To sCreatedDateTime
        Get ComStringOf Of hoJson "value[i].lastModifiedDateTime" To sLastModifiedDateTime
        Get ComStringOf Of hoJson "value[i].changeKey" To sChangeKey
        Get ComStringOf Of hoJson "value[i].originalStartTimeZone" To sOriginalStartTimeZone
        Get ComStringOf Of hoJson "value[i].originalEndTimeZone" To sOriginalEndTimeZone
        Get ComStringOf Of hoJson "value[i].iCalUId" To sICalUId
        Get ComIntOf Of hoJson "value[i].reminderMinutesBeforeStart" To iReminderMinutesBeforeStart
        Get ComBoolOf Of hoJson "value[i].isReminderOn" To iIsReminderOn
        Get ComBoolOf Of hoJson "value[i].hasAttachments" To iHasAttachments
        Get ComStringOf Of hoJson "value[i].subject" To sSubject
        Get ComStringOf Of hoJson "value[i].bodyPreview" To sBodyPreview
        Get ComStringOf Of hoJson "value[i].importance" To sImportance
        Get ComStringOf Of hoJson "value[i].sensitivity" To sSensitivity
        Get ComBoolOf Of hoJson "value[i].isAllDay" To iIsAllDay
        Get ComBoolOf Of hoJson "value[i].isCancelled" To iIsCancelled
        Get ComBoolOf Of hoJson "value[i].isOrganizer" To iIsOrganizer
        Get ComBoolOf Of hoJson "value[i].responseRequested" To iResponseRequested
        Get ComStringOf Of hoJson "value[i].seriesMasterId" To sSeriesMasterId
        Get ComStringOf Of hoJson "value[i].showAs" To sShowAs
        Get ComStringOf Of hoJson "value[i].type" To sV_type
        Get ComStringOf Of hoJson "value[i].webLink" To sWebLink
        Get ComStringOf Of hoJson "value[i].onlineMeetingUrl" To sOnlineMeetingUrl
        Get ComStringOf Of hoJson "value[i].recurrence" To sRecurrence
        Get ComStringOf Of hoJson "value[i].responseStatus.response" To sResponseStatusResponse
        Get ComStringOf Of hoJson "value[i].responseStatus.time" To sResponseStatusTime
        Get ComStringOf Of hoJson "value[i].body.contentType" To sBodyContentType
        Get ComStringOf Of hoJson "value[i].body.content" To sBodyContent
        Get ComStringOf Of hoJson "value[i].start.dateTime" To sStartDateTime
        Get ComStringOf Of hoJson "value[i].start.timeZone" To sStartTimeZone
        Get ComStringOf Of hoJson "value[i].end.dateTime" To sEndDateTime
        Get ComStringOf Of hoJson "value[i].end.timeZone" To sEndTimeZone
        Get ComStringOf Of hoJson "value[i].location.displayName" To sLocationDisplayName
        Get ComStringOf Of hoJson "value[i].location.locationType" To sLocationLocationType
        Get ComStringOf Of hoJson "value[i].location.uniqueId" To sLocationUniqueId
        Get ComStringOf Of hoJson "value[i].location.uniqueIdType" To sLocationUniqueIdType
        Get ComStringOf Of hoJson "value[i].organizer.emailAddress.name" To sOrganizerEmailAddressName
        Get ComStringOf Of hoJson "value[i].organizer.emailAddress.address" To sOrganizerEmailAddressAddress
        Move 0 To j
        Get ComSizeOfArray Of hoJson "value[i].categories" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            // ...
            Move j + 1 To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "value[i].locations" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComStringOf Of hoJson "value[i].locations[j].displayName" To sDisplayName
            Get ComStringOf Of hoJson "value[i].locations[j].locationType" To sLocationType
            Get ComStringOf Of hoJson "value[i].locations[j].uniqueId" To sUniqueId
            Get ComStringOf Of hoJson "value[i].locations[j].uniqueIdType" To sUniqueIdType
            Move j + 1 To j
        Loop

        Move 0 To j
        Get ComSizeOfArray Of hoJson "value[i].attendees" To iCount_j
        While (j < iCount_j)
            Set ComJ Of hoJson To j
            Get ComStringOf Of hoJson "value[i].attendees[j].type" To sV_type
            Get ComStringOf Of hoJson "value[i].attendees[j].status.response" To sStatusResponse
            Get ComStringOf Of hoJson "value[i].attendees[j].status.time" To sStatusTime
            Get ComStringOf Of hoJson "value[i].attendees[j].emailAddress.name" To sEmailAddressName
            Get ComStringOf Of hoJson "value[i].attendees[j].emailAddress.address" To sEmailAddressAddress
            Move j + 1 To j
        Loop

        Move i + 1 To i
    Loop

    Showln "Success."


End_Procedure

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.