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

PowerBuilder 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

 

 

 

(PowerBuilder) MS Graph Calendar Create Event

Creates a new event in a specified calendar.

For more details, see https://docs.microsoft.com/en-us/graph/api/calendar-post-events?view=graph-rest-1.0

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_Http
oleobject loo_JsonToken
integer li_Success
oleobject loo_Json
oleobject loo_Resp
string ls_DisplayName
string ls_LocationType
string ls_UniqueId
string ls_UniqueIdType
string ls_StatusResponse
string ls_StatusTime
string ls_EmailAddressName
string ls_EmailAddressAddress
string ls_OdataContext
string ls_OdataEtag
string ls_Id
string ls_CreatedDateTime
string ls_LastModifiedDateTime
string ls_ChangeKey
string ls_OriginalStartTimeZone
string ls_OriginalEndTimeZone
string ls_ICalUId
string ls_ReminderMinutesBeforeStart
string ls_IsReminderOn
string ls_HasAttachments
string ls_Subject
string ls_BodyPreview
string ls_Importance
string ls_Sensitivity
string ls_IsAllDay
string ls_IsCancelled
string ls_IsOrganizer
string ls_ResponseRequested
string ls_SeriesMasterId
string ls_ShowAs
string ls_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 i
integer li_Count_i

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

// Create a JSON body for the HTTP POST
// Use this online tool to generate the code from sample JSON: 
// Generate Code to Create JSON

// {
//   "subject": "Let's go for lunch",
//   "body": {
//     "contentType": "HTML",
//     "content": "Does mid month work for you?"
//   },
//   "start": {
//       "dateTime": "2019-11-15T12:00:00",
//       "timeZone": "Pacific Standard Time"
//   },
//   "end": {
//       "dateTime": "2019-11-15T14:00:00",
//       "timeZone": "Pacific Standard Time"
//   },
//   "location":{
//       "displayName":"Harry's Bar"
//   },
//   "attendees": [
//     {
//       "emailAddress": {
//         "address":"adelev@contoso.onmicrosoft.com",
//         "name": "Adele Vance"
//       },
//       "type": "required"
//     }
//   ]
// }

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.UpdateString("subject","Let's go for lunch")
loo_Json.UpdateString("body.contentType","HTML")
loo_Json.UpdateString("body.content","Does mid month work for you?")
loo_Json.UpdateString("start.dateTime","2019-11-15T12:00:00")
loo_Json.UpdateString("start.timeZone","Pacific Standard Time")
loo_Json.UpdateString("end.dateTime","2019-11-15T14:00:00")
loo_Json.UpdateString("end.timeZone","Pacific Standard Time")
loo_Json.UpdateString("location.displayName","Harry's Bar")
loo_Json.UpdateString("attendees[0].emailAddress.address","adelev@contoso.onmicrosoft.com")
loo_Json.UpdateString("attendees[0].emailAddress.name","Adele Vance")
loo_Json.UpdateString("attendees[0].type","required")

// POST the JSON to https://graph.microsoft.com/v1.0/me/calendars/{id}/events
// This is posting to a calendar in the default calendarGroup.

// Specify the calendar id
loo_Http.SetUrlVar("id","AQMkADAwATM0MDAAMS1iNTcwLWI2NTEtMDACLTAwCgBGAAADsVyfxjDU406Ic4X7ill8xAcA5_vF7TKKdE6bGCRqXyl2PQAAAgEGAAAA5_vF7TKKdE6bGCRqXyl2PQAClEpRTgAAAA==")
loo_Resp = loo_Http.PostJson3("https://graph.microsoft.com/v1.0/me/calendars/{$id}/events","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_Json
    return
end if

loo_Json.Load(loo_Resp.BodyStr)
loo_Json.EmitCompact = 0

if loo_Resp.StatusCode <> 201 then
    Write-Debug loo_Json.Emit()
    Write-Debug "Failed, response status code = " + string(loo_Resp.StatusCode)
    destroy loo_Resp
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_Json
    return
end if

destroy loo_Resp

Write-Debug loo_Json.Emit()

// A sample response:
// (See code for parsing this response below..)

// {
//   "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('admin%40chilkat.io')/calendars('AQMkADAwATM0MDAAMS ... AClEpRTgAAAA%3D%3D')/events/$entity",
//   "@odata.etag": "W/\"5+vF7TKKdE6bGCRqXyl2PQAClIgmmw==\"",
//   "id": "AQMkADAwAT ... ApRZ7JkAAAA=",
//   "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": "040000008200E00074C5B7101A82E00800000000F05DF1C23CFCD40100000000000000001000000009911D155F71EF42A230FEBFE5F7486A",
//   "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=AQMkADAwATM0MDAAMS1iNTcwL...pRZ7JkAAAA%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-15T12:00:00.0000000",
//     "timeZone": "Pacific Standard Time"
//   },
//   "end": {
//     "dateTime": "2019-11-15T14:00:00.0000000",
//     "timeZone": "Pacific Standard Time"
//   },
//   "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~"")
ls_OdataEtag = loo_Json.StringOf("~"@odata.etag~"")
ls_Id = loo_Json.StringOf("id")
ls_CreatedDateTime = loo_Json.StringOf("createdDateTime")
ls_LastModifiedDateTime = loo_Json.StringOf("lastModifiedDateTime")
ls_ChangeKey = loo_Json.StringOf("changeKey")
ls_OriginalStartTimeZone = loo_Json.StringOf("originalStartTimeZone")
ls_OriginalEndTimeZone = loo_Json.StringOf("originalEndTimeZone")
ls_ICalUId = loo_Json.StringOf("iCalUId")
ls_ReminderMinutesBeforeStart = loo_Json.IntOf("reminderMinutesBeforeStart")
ls_IsReminderOn = loo_Json.BoolOf("isReminderOn")
ls_HasAttachments = loo_Json.BoolOf("hasAttachments")
ls_Subject = loo_Json.StringOf("subject")
ls_BodyPreview = loo_Json.StringOf("bodyPreview")
ls_Importance = loo_Json.StringOf("importance")
ls_Sensitivity = loo_Json.StringOf("sensitivity")
ls_IsAllDay = loo_Json.BoolOf("isAllDay")
ls_IsCancelled = loo_Json.BoolOf("isCancelled")
ls_IsOrganizer = loo_Json.BoolOf("isOrganizer")
ls_ResponseRequested = loo_Json.BoolOf("responseRequested")
ls_SeriesMasterId = loo_Json.StringOf("seriesMasterId")
ls_ShowAs = loo_Json.StringOf("showAs")
ls_Type = loo_Json.StringOf("type")
ls_WebLink = loo_Json.StringOf("webLink")
ls_OnlineMeetingUrl = loo_Json.StringOf("onlineMeetingUrl")
ls_Recurrence = loo_Json.StringOf("recurrence")
ls_ResponseStatusResponse = loo_Json.StringOf("responseStatus.response")
ls_ResponseStatusTime = loo_Json.StringOf("responseStatus.time")
ls_BodyContentType = loo_Json.StringOf("body.contentType")
ls_BodyContent = loo_Json.StringOf("body.content")
ls_StartDateTime = loo_Json.StringOf("start.dateTime")
ls_StartTimeZone = loo_Json.StringOf("start.timeZone")
ls_EndDateTime = loo_Json.StringOf("end.dateTime")
ls_EndTimeZone = loo_Json.StringOf("end.timeZone")
ls_LocationDisplayName = loo_Json.StringOf("location.displayName")
ls_LocationLocationType = loo_Json.StringOf("location.locationType")
ls_LocationUniqueId = loo_Json.StringOf("location.uniqueId")
ls_LocationUniqueIdType = loo_Json.StringOf("location.uniqueIdType")
ls_OrganizerEmailAddressName = loo_Json.StringOf("organizer.emailAddress.name")
ls_OrganizerEmailAddressAddress = loo_Json.StringOf("organizer.emailAddress.address")
i = 0
li_Count_i = loo_Json.SizeOfArray("categories")
do while i < li_Count_i
    loo_Json.I = i
    // ...
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("locations")
do while i < li_Count_i
    loo_Json.I = i
    ls_DisplayName = loo_Json.StringOf("locations[i].displayName")
    ls_LocationType = loo_Json.StringOf("locations[i].locationType")
    ls_UniqueId = loo_Json.StringOf("locations[i].uniqueId")
    ls_UniqueIdType = loo_Json.StringOf("locations[i].uniqueIdType")
    i = i + 1
loop
i = 0
li_Count_i = loo_Json.SizeOfArray("attendees")
do while i < li_Count_i
    loo_Json.I = i
    ls_Type = loo_Json.StringOf("attendees[i].type")
    ls_StatusResponse = loo_Json.StringOf("attendees[i].status.response")
    ls_StatusTime = loo_Json.StringOf("attendees[i].status.time")
    ls_EmailAddressName = loo_Json.StringOf("attendees[i].emailAddress.name")
    ls_EmailAddressAddress = loo_Json.StringOf("attendees[i].emailAddress.address")
    i = i + 1
loop

Write-Debug "Success."


destroy loo_Http
destroy loo_JsonToken
destroy loo_Json

 

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