Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Node.js Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Node.js) 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

Install Chilkat for Node.js and Electron using npm at

Chilkat npm packages for Node.js

Chilkat npm packages for Electron

on Windows, Linux, MacOSX, and ARM

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}

function chilkatExample() {

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

    var http = new chilkat.Http();

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

    var jsonToken = new chilkat.JsonObject();
    var success = jsonToken.LoadFile("qa_data/tokens/msGraphCalendar.json");
    if (success == false) {
        console.log(jsonToken.LastErrorText);
        return;
    }

    http.AuthToken = jsonToken.StringOf("access_token");

    // Specify the calendar id
    http.SetUrlVar("id","AQMkADAwATM0MDAAMS1iNTcwLWI2NTEtMDACLTAwCgBGAAADsVyfxjDU406Ic4X7ill8xAcA5_vF7TKKdE6bGCRqXyl2PQAAAgEGAAAA5_vF7TKKdE6bGCRqXyl2PQAClEpRTgAAAA==");
    // Send a GET request to https://graph.microsoft.com/v1.0/me/calendars/{$id}/events
    var strResponse = http.QuickGetStr("https://graph.microsoft.com/v1.0/me/calendars/{$id}/events");
    if (http.LastMethodSuccess == false) {
        console.log(http.LastErrorText);
        return;
    }

    var json = new chilkat.JsonObject();
    json.Load(strResponse);
    json.EmitCompact = false;

    if (http.LastStatus !== 200) {
        console.log(json.Emit());
        console.log("Failed, response status code = " + http.LastStatus);
        return;
    }

    console.log(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

    var odataContext;
    var i;
    var count_i;
    var odataEtag;
    var id;
    var createdDateTime;
    var lastModifiedDateTime;
    var changeKey;
    var originalStartTimeZone;
    var originalEndTimeZone;
    var iCalUId;
    var reminderMinutesBeforeStart;
    var isReminderOn;
    var hasAttachments;
    var subject;
    var bodyPreview;
    var importance;
    var sensitivity;
    var isAllDay;
    var isCancelled;
    var isOrganizer;
    var responseRequested;
    var seriesMasterId;
    var showAs;
    var v_type;
    var webLink;
    var onlineMeetingUrl;
    var recurrence;
    var responseStatusResponse;
    var responseStatusTime;
    var bodyContentType;
    var bodyContent;
    var startDateTime;
    var startTimeZone;
    var endDateTime;
    var endTimeZone;
    var locationDisplayName;
    var locationLocationType;
    var locationUniqueId;
    var locationUniqueIdType;
    var organizerEmailAddressName;
    var organizerEmailAddressAddress;
    var j;
    var count_j;
    var displayName;
    var locationType;
    var uniqueId;
    var uniqueIdType;
    var statusResponse;
    var statusTime;
    var emailAddressName;
    var emailAddressAddress;

    odataContext = json.StringOf("\"@odata.context\"");
    i = 0;
    count_i = json.SizeOfArray("value");
    while (i < count_i) {
        json.I = i;
        odataEtag = json.StringOf("value[i].\"@odata.etag\"");
        id = json.StringOf("value[i].id");
        createdDateTime = json.StringOf("value[i].createdDateTime");
        lastModifiedDateTime = json.StringOf("value[i].lastModifiedDateTime");
        changeKey = json.StringOf("value[i].changeKey");
        originalStartTimeZone = json.StringOf("value[i].originalStartTimeZone");
        originalEndTimeZone = json.StringOf("value[i].originalEndTimeZone");
        iCalUId = json.StringOf("value[i].iCalUId");
        reminderMinutesBeforeStart = json.IntOf("value[i].reminderMinutesBeforeStart");
        isReminderOn = json.BoolOf("value[i].isReminderOn");
        hasAttachments = json.BoolOf("value[i].hasAttachments");
        subject = json.StringOf("value[i].subject");
        bodyPreview = json.StringOf("value[i].bodyPreview");
        importance = json.StringOf("value[i].importance");
        sensitivity = json.StringOf("value[i].sensitivity");
        isAllDay = json.BoolOf("value[i].isAllDay");
        isCancelled = json.BoolOf("value[i].isCancelled");
        isOrganizer = json.BoolOf("value[i].isOrganizer");
        responseRequested = json.BoolOf("value[i].responseRequested");
        seriesMasterId = json.StringOf("value[i].seriesMasterId");
        showAs = json.StringOf("value[i].showAs");
        v_type = json.StringOf("value[i].type");
        webLink = json.StringOf("value[i].webLink");
        onlineMeetingUrl = json.StringOf("value[i].onlineMeetingUrl");
        recurrence = json.StringOf("value[i].recurrence");
        responseStatusResponse = json.StringOf("value[i].responseStatus.response");
        responseStatusTime = json.StringOf("value[i].responseStatus.time");
        bodyContentType = json.StringOf("value[i].body.contentType");
        bodyContent = json.StringOf("value[i].body.content");
        startDateTime = json.StringOf("value[i].start.dateTime");
        startTimeZone = json.StringOf("value[i].start.timeZone");
        endDateTime = json.StringOf("value[i].end.dateTime");
        endTimeZone = json.StringOf("value[i].end.timeZone");
        locationDisplayName = json.StringOf("value[i].location.displayName");
        locationLocationType = json.StringOf("value[i].location.locationType");
        locationUniqueId = json.StringOf("value[i].location.uniqueId");
        locationUniqueIdType = json.StringOf("value[i].location.uniqueIdType");
        organizerEmailAddressName = json.StringOf("value[i].organizer.emailAddress.name");
        organizerEmailAddressAddress = json.StringOf("value[i].organizer.emailAddress.address");
        j = 0;
        count_j = json.SizeOfArray("value[i].categories");
        while (j < count_j) {
            json.J = j;
            // ...
            j = j+1;
        }

        j = 0;
        count_j = json.SizeOfArray("value[i].locations");
        while (j < count_j) {
            json.J = j;
            displayName = json.StringOf("value[i].locations[j].displayName");
            locationType = json.StringOf("value[i].locations[j].locationType");
            uniqueId = json.StringOf("value[i].locations[j].uniqueId");
            uniqueIdType = json.StringOf("value[i].locations[j].uniqueIdType");
            j = j+1;
        }

        j = 0;
        count_j = json.SizeOfArray("value[i].attendees");
        while (j < count_j) {
            json.J = j;
            v_type = json.StringOf("value[i].attendees[j].type");
            statusResponse = json.StringOf("value[i].attendees[j].status.response");
            statusTime = json.StringOf("value[i].attendees[j].status.time");
            emailAddressName = json.StringOf("value[i].attendees[j].emailAddress.name");
            emailAddressAddress = json.StringOf("value[i].attendees[j].emailAddress.address");
            j = j+1;
        }

        i = i+1;
    }

    console.log("Success.");

}

chilkatExample();

 

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