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

AutoIt 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
Jira
Lightspeed
MYOB
Magento
Mailgun

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
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
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

 

 

 

(AutoIt) MedTunnel: Get Mailbox Messages

See more MedTunnel Examples

Get the messages in the specified mailbox. The logged in user must have access to the mailbox.

For more information, see https://server.medtunnel.com/apidocs/html/M_MedTunnelMsg_Controllers_MessageController_GetMailBoxMessages.htm

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

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

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

; Implements the following CURL command:

; curl -X GET -k 
;         -H "Authorization:PutAuthorizationTokenHere" 
;         https://server.medtunnel.com/medtunnelmsg/api/Message/GetMailBoxMessages?MailBoxId=623&OnlyMessagesWithAttachments=false&LastMessageId=27812&StartRow=3&RowCount=25&UnReadOnly=false&IncludeAllMailBoxes=false

; Use the following online tool to generate HTTP code from a CURL command
; Convert a cURL Command to HTTP Source Code

$oHttp.SetRequestHeader "Authorization","PutAuthorizationTokenHere"

; The mailbox id is contained in the JSON response from the login.
$oHttp.SetUrlVar("mailboxId","36965")
$oHttp.SetUrlVar("onlyMessagesWithAttachments","false")
$oHttp.SetUrlVar("lastMessageId","0")
$oHttp.SetUrlVar("startRow","0")
$oHttp.SetUrlVar("rowCount","25")
$oHttp.SetUrlVar("unReadOnly","false")
$oHttp.SetUrlVar("includeAllMailBoxes","false")

$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oHttp.QuickGetSb("https://server.medtunnel.com/medtunnelmsg/api/Message/GetMailBoxMessages?MailBoxId={$mailboxId}&OnlyMessagesWithAttachments={$onlyMessagesWithAttachments}&LastMessageId={$lastMessageId}&StartRow={$startRow}&RowCount={$rowCount}&UnReadOnly={$unReadOnly}&IncludeAllMailBoxes={$includeAllMailBoxes}",$oSbResponseBody)
If ($bSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

$oJResp = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False

ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)

Local $iRespStatusCode = $oHttp.LastStatus
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oHttp.LastHeader & @CRLF)
    ConsoleWrite("Failed." & @CRLF)
    Exit
EndIf

; Sample JSON response:
; (Sample code for parsing the JSON response is shown below)

; {
;   "ReturnCode": 1,
;   "ReturnCodeText": "Success",
;   "Data": "[...]"
; }

; Sample code for parsing the JSON response...
; Use the following online tool to generate parsing code from sample JSON:
; Generate Parsing Code from JSON

Local $iReturnCode = $oJResp.IntOf("ReturnCode")
Local $sReturnCodeText = $oJResp.StringOf("ReturnCodeText")
Local $sData = $oJResp.StringOf("Data")

; The Data contains a JSON array, so load it into a Chilkat JSON array object.
$oJarr = ObjCreate("Chilkat_9_5_0.JsonArray")
$oJarr.Load($sData)
$oJarr.EmitCompact = False
ConsoleWrite($oJarr.Emit() & @CRLF)

; Sample jsonArray content
; See sample code for parsing this content below..

; [
;   {
;     "Id": 989448,
;     "FromUserId": 36990,
;     "FromMailBoxId": 36965,
;     "FromUserType": 1,
;     "FromUserName": "joe@example",
;     "FromUserFullName": "Joe Smith",
;     "FromUserAccountName": "joe",
;     "FromUserAccountTitle": "Joe's Garage, Inc.",
;     "ToUserId": 36990,
;     "ToUserType": 1,
;     "ToUserMailboxId": "36965",
;     "ToUserName": "joe@example",
;     "ToUserFullName": "Joe Smith",
;     "EmailAddress": "",
;     "Password": "",
;     "Subject": "",
;     "PatientMedTunnelId": "",
;     "Body": "Test",
;     "DateReceived": "4/29/2021 2:48:22 PM",
;     "DisplayDateReceived": "Today  2:48 PM",
;     "ViewCount": 3,
;     "ViewedOn": "04/29/2021  2:52 PM",
;     "AttachmentCount": 1,
;     "AttachmentNames": [
;       {
;         "MessageId": 989448,
;         "Id": 424857,
;         "Name": "starfish.jpg.35910fe9-4118-414c-a845-4d092ca6e784",
;         "DisplayName": "starfish.jpg",
;         "Size": 6229,
;         "WasViewed": true,
;         "ViewedOn": "4/29/2021 2:52:19 PM",
;         "ViewCount": 1,
;         "Location": "Default"
;       }
;     ],
;     "AllRecipients": [
;       {
;         "Id": 989448,
;         "UserName": "joe@example",
;         "AccountId": 0,
;         "AccountName": "joe",
;         "AccountTitle": null,
;         "FirstName": "Joe",
;         "LastName": "Smith",
;         "EmailAddress": null,
;         "LastSentOn": null,
;         "SendCount": 0,
;         "IsFavorite": false
;       }
;     ],
;     "Status": 3,
;     "ParentMessageId": 989448,
;     "DistributionListId": 0,
;     "DistributionListName": "",
;     "BodyHistory": "",
;     "ReadReceiptCallbackUrl": null,
;     "SendGlobalNotifications": false
;   },
;   {
;     "Id": 989445,
;     "FromUserId": 36990,
;     "FromMailBoxId": 36965,
;     "FromUserType": 1,
;     "FromUserName": "joe@example",
;     "FromUserFullName": "Joe Smith",
;     "FromUserAccountName": "joe",
;     "FromUserAccountTitle": "Joe's Garage, Inc.",
;     "ToUserId": 36990,
;     "ToUserType": 1,
;     "ToUserMailboxId": "36965",
;     "ToUserName": "joe@example",
;     "ToUserFullName": "Joe Smith",
;     "EmailAddress": "",
;     "Password": "",
;     "Subject": "",
;     "PatientMedTunnelId": "",
;     "Body": "Test",
;     "DateReceived": "4/29/2021 2:47:36 PM",
;     "DisplayDateReceived": "Today  2:47 PM",
;     "ViewCount": 1,
;     "ViewedOn": "",
;     "AttachmentCount": 1,
;     "AttachmentNames": [
;       {
;         "MessageId": 989445,
;         "Id": 424856,
;         "Name": "starfish.jpg.c7dd04d8-43f2-4d86-af71-64f411bd5dfb",
;         "DisplayName": "starfish.jpg",
;         "Size": 6229,
;         "WasViewed": false,
;         "ViewedOn": "",
;         "ViewCount": 0,
;         "Location": "Default"
;       }
;     ],
;     "AllRecipients": [
;       {
;         "Id": 989445,
;         "UserName": "joe@example",
;         "AccountId": 0,
;         "AccountName": "joe",
;         "AccountTitle": null,
;         "FirstName": "Joe",
;         "LastName": "Smith",
;         "EmailAddress": null,
;         "LastSentOn": null,
;         "SendCount": 0,
;         "IsFavorite": false
;       }
;     ],
;     "Status": 3,
;     "ParentMessageId": 989445,
;     "DistributionListId": 0,
;     "DistributionListName": "",
;     "BodyHistory": "",
;     "ReadReceiptCallbackUrl": null,
;     "SendGlobalNotifications": false
;   },
;   {
;     "Id": 989436,
;     "FromUserId": 36990,
;     "FromMailBoxId": 36965,
;     "FromUserType": 1,
;     "FromUserName": "joe@example",
;     "FromUserFullName": "Joe Smith",
;     "FromUserAccountName": "joe",
;     "FromUserAccountTitle": "Joe's Garage, Inc.",
;     "ToUserId": 36990,
;     "ToUserType": 1,
;     "ToUserMailboxId": "36965",
;     "ToUserName": "joe@example",
;     "ToUserFullName": "Joe Smith",
;     "EmailAddress": "",
;     "Password": "",
;     "Subject": "",
;     "PatientMedTunnelId": "",
;     "Body": "Test",
;     "DateReceived": "4/29/2021 2:29:18 PM",
;     "DisplayDateReceived": "Today  2:29 PM",
;     "ViewCount": 1,
;     "ViewedOn": "",
;     "AttachmentCount": 0,
;     "AttachmentNames": [
;     ],
;     "AllRecipients": [
;       {
;         "Id": 989436,
;         "UserName": "joe@example",
;         "AccountId": 0,
;         "AccountName": "joe",
;         "AccountTitle": null,
;         "FirstName": "Joe",
;         "LastName": "Smith",
;         "EmailAddress": null,
;         "LastSentOn": null,
;         "SendCount": 0,
;         "IsFavorite": false
;       }
;     ],
;     "Status": 3,
;     "ParentMessageId": 989436,
;     "DistributionListId": 0,
;     "DistributionListName": "",
;     "BodyHistory": "",
;     "ReadReceiptCallbackUrl": null,
;     "SendGlobalNotifications": false
;   },
;   {
;     "Id": 989432,
;     "FromUserId": 36990,
;     "FromMailBoxId": 36965,
;     "FromUserType": 1,
;     "FromUserName": "joe@example",
;     "FromUserFullName": "Joe Smith",
;     "FromUserAccountName": "joe",
;     "FromUserAccountTitle": "Joe's Garage, Inc.",
;     "ToUserId": 36990,
;     "ToUserType": 1,
;     "ToUserMailboxId": "36965",
;     "ToUserName": "joe@example",
;     "ToUserFullName": "Joe Smith",
;     "EmailAddress": "",
;     "Password": "",
;     "Subject": "",
;     "PatientMedTunnelId": "",
;     "Body": "Test",
;     "DateReceived": "4/29/2021 2:25:27 PM",
;     "DisplayDateReceived": "Today  2:25 PM",
;     "ViewCount": 1,
;     "ViewedOn": "",
;     "AttachmentCount": 0,
;     "AttachmentNames": [
;     ],
;     "AllRecipients": [
;       {
;         "Id": 989432,
;         "UserName": "joe@example",
;         "AccountId": 0,
;         "AccountName": "joe",
;         "AccountTitle": null,
;         "FirstName": "Joe",
;         "LastName": "Smith",
;         "EmailAddress": null,
;         "LastSentOn": null,
;         "SendCount": 0,
;         "IsFavorite": false
;       }
;     ],
;     "Status": 3,
;     "ParentMessageId": 989432,
;     "DistributionListId": 0,
;     "DistributionListName": "",
;     "BodyHistory": "",
;     "ReadReceiptCallbackUrl": null,
;     "SendGlobalNotifications": false
;   },
;   {
;     "Id": 989251,
;     "FromUserId": 1,
;     "FromMailBoxId": 1,
;     "FromUserType": 100,
;     "FromUserName": "MedTunnel",
;     "FromUserFullName": "System Account",
;     "FromUserAccountName": "MedTunnel",
;     "FromUserAccountTitle": "",
;     "ToUserId": 36990,
;     "ToUserType": 1,
;     "ToUserMailboxId": "36965",
;     "ToUserName": "joe@example",
;     "ToUserFullName": "Joe Smith",
;     "EmailAddress": "",
;     "Password": "",
;     "Subject": "",
;     "PatientMedTunnelId": "",
;     "Body": "Welcome to MedTunnel! \r\n\r\nNow that you have signed up and activated your account, you are ready to start sending secure messages and documents using MedTunnel. So, what is the next step? It is recommended that you watch our training videos to learn how to use MedTunnel. There are 3 different client applications that you can use to access MedTunnel: \r\n\r\n1. If you are an administrator for a group, you should start out with the \u003cb\u003eGroup Account Administrators Video\u003c/b\u003e (\u003ca href=\"https://vimeo.com/104428633\" target=\"_blank\"\u003ehttps://vimeo.com/104428633\u003c/a\u003e). This video shows you the best practices for implementing MedTunnel into your practice, as well as how to add additional users. \r\n\r\n2. Next, watch the \u003cb\u003eMedTunnel Desktop App Video\u003c/b\u003e (\u003ca href=\"https://vimeo.com/103833157\" target=\"_blank\"\u003ehttps://vimeo.com/103833157\u003c/a\u003e). This video shows how to use the MedTunnel Desktop App - available as a free download for both PC and Mac. The Desktop App has 2 main features:\r\n\r\n\t- The \u003cb\u003ePrint-To-Send\u003c/b\u003e feature allows you to print from any application to a virtual printer to conveniently send documents.\r\n\r\n\t- The \u003cb\u003eAutoDownloader\u003c/b\u003e feature allows you to automatically download messages to your local hard drive for instant integration into your existing systems.\r\n\r\n3. Finally, there are two other client videos you can watch. The \u003cb\u003eWeb Client Demo Video\u003c/b\u003e (\u003ca href=\"https://vimeo.com/104434128\" target=\"_blank\"\u003ehttps://vimeo.com/104434128\u003c/a\u003e) shows you how to access MedTunnel via a browser on any device. The \u003cb\u003eMobile App Demo Video\u003c/b\u003e (\u003ca href=\"https://vimeo.com/104065728\" target=\"_blank\"\u003ehttps://vimeo.com/104065728\u003c/a\u003e) shows you how to access MedTunnel from our free Mobile App. \r\n\r\nHere are some useful links. \r\n\r\nMedTunnel Support Page: \u003ca href=\"http://www.medtunnel.com/support\" target=\"_blank\"\u003ehttp://www.medtunnel.com/support\u003c/a\u003e. The support page contains links to download the Desktop and Mobile Apps as well as other support related content. \r\n\r\nFAQs Page: \u003ca href=\"http://www.medtunnel.com/faqs\" target=\"_blank\"\u003ehttp://www.medtunnel.com/faqs\u003c/a\u003e. The FAQs page contains the most frequently asked questions about MedTunnel. \r\n\r\nIf you have any other questions or would like personalized service on using MedTunnel, you can contact us by simply logging in to your MedTunnel account and sending a message to MedTunnel ID: \u003cb\u003esupport\u003c/b\u003e.   You can also contact us by sending an email to support@medtunnel.com. \r\n\r\nAgain - Welcome to MedTunnel! We truly hope you enjoy your MedTunnel experience!\r\n\r\nThe MedTunnel Team\r\n",
;     "DateReceived": "4/28/2021 10:58:30 PM",
;     "DisplayDateReceived": "04/28/2021 10:58 PM",
;     "ViewCount": 1,
;     "ViewedOn": "",
;     "AttachmentCount": 0,
;     "AttachmentNames": [
;     ],
;     "AllRecipients": [
;       {
;         "Id": 989251,
;         "UserName": "joe@example",
;         "AccountId": 0,
;         "AccountName": "joe",
;         "AccountTitle": null,
;         "FirstName": "Joe",
;         "LastName": "Smith",
;         "EmailAddress": null,
;         "LastSentOn": null,
;         "SendCount": 0,
;         "IsFavorite": false
;       }
;     ],
;     "Status": 3,
;     "ParentMessageId": 989251,
;     "DistributionListId": 0,
;     "DistributionListName": "",
;     "BodyHistory": "",
;     "ReadReceiptCallbackUrl": null,
;     "SendGlobalNotifications": false
;   }
; ]

Local $oJson
Local $iId
Local $iFromUserId
Local $iFromMailBoxId
Local $iFromUserType
Local $sFromUserName
Local $sFromUserFullName
Local $sFromUserAccountName
Local $sFromUserAccountTitle
Local $iToUserId
Local $iToUserType
Local $sToUserMailboxId
Local $sToUserName
Local $sToUserFullName
Local $sEmailAddress
Local $sPassword
Local $sSubject
Local $sPatientMedTunnelId
Local $sBody
Local $sDateReceived
Local $sDisplayDateReceived
Local $iViewCount
Local $sViewedOn
Local $iAttachmentCount
Local $iStatus
Local $iParentMessageId
Local $iDistributionListId
Local $sDistributionListName
Local $sBodyHistory
Local $sReadReceiptCallbackUrl
Local $bSendGlobalNotifications
Local $iJ
Local $iCount_j
Local $iMessageId
Local $sName
Local $sDisplayName
Local $iSize
Local $bWasViewed
Local $sLocation
Local $sUserName
Local $iAccountId
Local $sAccountName
Local $sAccountTitle
Local $sFirstName
Local $sLastName
Local $sLastSentOn
Local $iSendCount
Local $bIsFavorite

Local $i = 0
Local $iCount_i = $oJarr.Size
While $i < $iCount_i
    $oJson = $oJarr.ObjectAt($i)
    $iId = $oJson.IntOf("Id")
    $iFromUserId = $oJson.IntOf("FromUserId")
    $iFromMailBoxId = $oJson.IntOf("FromMailBoxId")
    $iFromUserType = $oJson.IntOf("FromUserType")
    $sFromUserName = $oJson.StringOf("FromUserName")
    $sFromUserFullName = $oJson.StringOf("FromUserFullName")
    $sFromUserAccountName = $oJson.StringOf("FromUserAccountName")
    $sFromUserAccountTitle = $oJson.StringOf("FromUserAccountTitle")
    $iToUserId = $oJson.IntOf("ToUserId")
    $iToUserType = $oJson.IntOf("ToUserType")
    $sToUserMailboxId = $oJson.StringOf("ToUserMailboxId")
    $sToUserName = $oJson.StringOf("ToUserName")
    $sToUserFullName = $oJson.StringOf("ToUserFullName")
    $sEmailAddress = $oJson.StringOf("EmailAddress")
    $sPassword = $oJson.StringOf("Password")
    $sSubject = $oJson.StringOf("Subject")
    $sPatientMedTunnelId = $oJson.StringOf("PatientMedTunnelId")
    $sBody = $oJson.StringOf("Body")
    $sDateReceived = $oJson.StringOf("DateReceived")
    $sDisplayDateReceived = $oJson.StringOf("DisplayDateReceived")
    $iViewCount = $oJson.IntOf("ViewCount")
    $sViewedOn = $oJson.StringOf("ViewedOn")
    $iAttachmentCount = $oJson.IntOf("AttachmentCount")
    $iStatus = $oJson.IntOf("Status")
    $iParentMessageId = $oJson.IntOf("ParentMessageId")
    $iDistributionListId = $oJson.IntOf("DistributionListId")
    $sDistributionListName = $oJson.StringOf("DistributionListName")
    $sBodyHistory = $oJson.StringOf("BodyHistory")
    $sReadReceiptCallbackUrl = $oJson.StringOf("ReadReceiptCallbackUrl")
    $bSendGlobalNotifications = $oJson.BoolOf("SendGlobalNotifications")
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("AttachmentNames")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $iMessageId = $oJson.IntOf("AttachmentNames[j].MessageId")
        $iId = $oJson.IntOf("AttachmentNames[j].Id")
        $sName = $oJson.StringOf("AttachmentNames[j].Name")
        $sDisplayName = $oJson.StringOf("AttachmentNames[j].DisplayName")
        $iSize = $oJson.IntOf("AttachmentNames[j].Size")
        $bWasViewed = $oJson.BoolOf("AttachmentNames[j].WasViewed")
        $sViewedOn = $oJson.StringOf("AttachmentNames[j].ViewedOn")
        $iViewCount = $oJson.IntOf("AttachmentNames[j].ViewCount")
        $sLocation = $oJson.StringOf("AttachmentNames[j].Location")
        $iJ = $iJ + 1
    Wend
    $iJ = 0
    $iCount_j = $oJson.SizeOfArray("AllRecipients")
    While $iJ < $iCount_j
        $oJson.J = $iJ
        $iId = $oJson.IntOf("AllRecipients[j].Id")
        $sUserName = $oJson.StringOf("AllRecipients[j].UserName")
        $iAccountId = $oJson.IntOf("AllRecipients[j].AccountId")
        $sAccountName = $oJson.StringOf("AllRecipients[j].AccountName")
        $sAccountTitle = $oJson.StringOf("AllRecipients[j].AccountTitle")
        $sFirstName = $oJson.StringOf("AllRecipients[j].FirstName")
        $sLastName = $oJson.StringOf("AllRecipients[j].LastName")
        $sEmailAddress = $oJson.StringOf("AllRecipients[j].EmailAddress")
        $sLastSentOn = $oJson.StringOf("AllRecipients[j].LastSentOn")
        $iSendCount = $oJson.IntOf("AllRecipients[j].SendCount")
        $bIsFavorite = $oJson.BoolOf("AllRecipients[j].IsFavorite")
        $iJ = $iJ + 1
    Wend

    $i = $i + 1
Wend

 

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