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

Visual FoxPro 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

 

 

 

(Visual FoxPro) 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

LOCAL loHttp
LOCAL loJsonToken
LOCAL lnSuccess
LOCAL lcStrResponse
LOCAL loJson
LOCAL lcOdataContext
LOCAL i
LOCAL lnCount_i
LOCAL lcOdataEtag
LOCAL lcId
LOCAL lcCreatedDateTime
LOCAL lcLastModifiedDateTime
LOCAL lcChangeKey
LOCAL lcOriginalStartTimeZone
LOCAL lcOriginalEndTimeZone
LOCAL lcICalUId
LOCAL lnReminderMinutesBeforeStart
LOCAL lnIsReminderOn
LOCAL lnHasAttachments
LOCAL lcSubject
LOCAL lcBodyPreview
LOCAL lcImportance
LOCAL lcSensitivity
LOCAL lnIsAllDay
LOCAL lnIsCancelled
LOCAL lnIsOrganizer
LOCAL lnResponseRequested
LOCAL lcSeriesMasterId
LOCAL lcShowAs
LOCAL lcV_type
LOCAL lcWebLink
LOCAL lcOnlineMeetingUrl
LOCAL lcRecurrence
LOCAL lcResponseStatusResponse
LOCAL lcResponseStatusTime
LOCAL lcBodyContentType
LOCAL lcBodyContent
LOCAL lcStartDateTime
LOCAL lcStartTimeZone
LOCAL lcEndDateTime
LOCAL lcEndTimeZone
LOCAL lcLocationDisplayName
LOCAL lcLocationLocationType
LOCAL lcLocationUniqueId
LOCAL lcLocationUniqueIdType
LOCAL lcOrganizerEmailAddressName
LOCAL lcOrganizerEmailAddressAddress
LOCAL j
LOCAL lnCount_j
LOCAL lcDisplayName
LOCAL lcLocationType
LOCAL lcUniqueId
LOCAL lcUniqueIdType
LOCAL lcStatusResponse
LOCAL lcStatusTime
LOCAL lcEmailAddressName
LOCAL lcEmailAddressAddress

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

loHttp = CreateObject('Chilkat_9_5_0.Http')

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

loJsonToken = CreateObject('Chilkat_9_5_0.JsonObject')
lnSuccess = loJsonToken.LoadFile("qa_data/tokens/msGraphCalendar.json")
IF (lnSuccess = 0) THEN
    ? loJsonToken.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    CANCEL
ENDIF

loHttp.AuthToken = loJsonToken.StringOf("access_token")

* Specify the calendar id
loHttp.SetUrlVar("id","AQMkADAwATM0MDAAMS1iNTcwLWI2NTEtMDACLTAwCgBGAAADsVyfxjDU406Ic4X7ill8xAcA5_vF7TKKdE6bGCRqXyl2PQAAAgEGAAAA5_vF7TKKdE6bGCRqXyl2PQAClEpRTgAAAA==")
* Send a GET request to https://graph.microsoft.com/v1.0/me/calendars/{$id}/events
lcStrResponse = loHttp.QuickGetStr("https://graph.microsoft.com/v1.0/me/calendars/{$id}/events")
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJsonToken
    CANCEL
ENDIF

loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.Load(lcStrResponse)
loJson.EmitCompact = 0

IF (loHttp.LastStatus <> 200) THEN
    ? loJson.Emit()
    ? "Failed, response status code = " + STR(loHttp.LastStatus)
    RELEASE loHttp
    RELEASE loJsonToken
    RELEASE loJson
    CANCEL
ENDIF

? loJson.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

lcOdataContext = loJson.StringOf('"@odata.context"')
i = 0
lnCount_i = loJson.SizeOfArray("value")
DO WHILE i < lnCount_i
    loJson.I = i
    lcOdataEtag = loJson.StringOf('value[i]."@odata.etag"')
    lcId = loJson.StringOf("value[i].id")
    lcCreatedDateTime = loJson.StringOf("value[i].createdDateTime")
    lcLastModifiedDateTime = loJson.StringOf("value[i].lastModifiedDateTime")
    lcChangeKey = loJson.StringOf("value[i].changeKey")
    lcOriginalStartTimeZone = loJson.StringOf("value[i].originalStartTimeZone")
    lcOriginalEndTimeZone = loJson.StringOf("value[i].originalEndTimeZone")
    lcICalUId = loJson.StringOf("value[i].iCalUId")
    lnReminderMinutesBeforeStart = loJson.IntOf("value[i].reminderMinutesBeforeStart")
    lnIsReminderOn = loJson.BoolOf("value[i].isReminderOn")
    lnHasAttachments = loJson.BoolOf("value[i].hasAttachments")
    lcSubject = loJson.StringOf("value[i].subject")
    lcBodyPreview = loJson.StringOf("value[i].bodyPreview")
    lcImportance = loJson.StringOf("value[i].importance")
    lcSensitivity = loJson.StringOf("value[i].sensitivity")
    lnIsAllDay = loJson.BoolOf("value[i].isAllDay")
    lnIsCancelled = loJson.BoolOf("value[i].isCancelled")
    lnIsOrganizer = loJson.BoolOf("value[i].isOrganizer")
    lnResponseRequested = loJson.BoolOf("value[i].responseRequested")
    lcSeriesMasterId = loJson.StringOf("value[i].seriesMasterId")
    lcShowAs = loJson.StringOf("value[i].showAs")
    lcV_type = loJson.StringOf("value[i].type")
    lcWebLink = loJson.StringOf("value[i].webLink")
    lcOnlineMeetingUrl = loJson.StringOf("value[i].onlineMeetingUrl")
    lcRecurrence = loJson.StringOf("value[i].recurrence")
    lcResponseStatusResponse = loJson.StringOf("value[i].responseStatus.response")
    lcResponseStatusTime = loJson.StringOf("value[i].responseStatus.time")
    lcBodyContentType = loJson.StringOf("value[i].body.contentType")
    lcBodyContent = loJson.StringOf("value[i].body.content")
    lcStartDateTime = loJson.StringOf("value[i].start.dateTime")
    lcStartTimeZone = loJson.StringOf("value[i].start.timeZone")
    lcEndDateTime = loJson.StringOf("value[i].end.dateTime")
    lcEndTimeZone = loJson.StringOf("value[i].end.timeZone")
    lcLocationDisplayName = loJson.StringOf("value[i].location.displayName")
    lcLocationLocationType = loJson.StringOf("value[i].location.locationType")
    lcLocationUniqueId = loJson.StringOf("value[i].location.uniqueId")
    lcLocationUniqueIdType = loJson.StringOf("value[i].location.uniqueIdType")
    lcOrganizerEmailAddressName = loJson.StringOf("value[i].organizer.emailAddress.name")
    lcOrganizerEmailAddressAddress = loJson.StringOf("value[i].organizer.emailAddress.address")
    j = 0
    lnCount_j = loJson.SizeOfArray("value[i].categories")
    DO WHILE j < lnCount_j
        loJson.J = j
        * ...
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJson.SizeOfArray("value[i].locations")
    DO WHILE j < lnCount_j
        loJson.J = j
        lcDisplayName = loJson.StringOf("value[i].locations[j].displayName")
        lcLocationType = loJson.StringOf("value[i].locations[j].locationType")
        lcUniqueId = loJson.StringOf("value[i].locations[j].uniqueId")
        lcUniqueIdType = loJson.StringOf("value[i].locations[j].uniqueIdType")
        j = j + 1
    ENDDO
    j = 0
    lnCount_j = loJson.SizeOfArray("value[i].attendees")
    DO WHILE j < lnCount_j
        loJson.J = j
        lcV_type = loJson.StringOf("value[i].attendees[j].type")
        lcStatusResponse = loJson.StringOf("value[i].attendees[j].status.response")
        lcStatusTime = loJson.StringOf("value[i].attendees[j].status.time")
        lcEmailAddressName = loJson.StringOf("value[i].attendees[j].emailAddress.name")
        lcEmailAddressAddress = loJson.StringOf("value[i].attendees[j].emailAddress.address")
        j = j + 1
    ENDDO
    i = i + 1
ENDDO

? "Success."

RELEASE loHttp
RELEASE loJsonToken
RELEASE loJson


 

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