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 Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(PowerBuilder) Outlook List Contacts

See more Outlook Contact Examples

List Outlook Contacts

For more information, see https://docs.microsoft.com/en-us/graph/api/user-list-contacts?view=graph-rest-1.0&tabs=http

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_SbJson
integer li_StatusCode
oleobject loo_JResp
string ls_Odata_etag
string ls_Id
string ls_CreatedDateTime
string ls_LastModifiedDateTime
string ls_ChangeKey
string ls_ParentFolderId
string ls_Birthday
string ls_FileAs
string ls_DisplayName
string ls_GivenName
string ls_Initials
string ls_MiddleName
string ls_NickName
string ls_Surname
string ls_Title
string ls_YomiGivenName
string ls_YomiSurname
string ls_YomiCompanyName
string ls_Generation
string ls_JobTitle
string ls_CompanyName
string ls_Department
string ls_OfficeLocation
string ls_Profession
string ls_BusinessHomePage
string ls_AssistantName
string ls_Manager
string ls_MobilePhone
string ls_SpouseName
string ls_PersonalNotes
integer j
integer li_Count_j
string ls_StrVal
string ls_Name
string ls_Address
string ls_Odata_context
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 here: Get Outlook Contacts OAuth2 Access Token (Azure AD v2.0 Endpoint).

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

// Send the following GET:

// GET https://graph.microsoft.com/v1.0/me/contacts
loo_SbJson = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbJson.ConnectToNewObject("Chilkat.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://graph.microsoft.com/v1.0/me/contacts",loo_SbJson)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbJson
    return
end if

li_StatusCode = loo_Http.LastStatus
Write-Debug "Response status code = " + string(li_StatusCode)

if li_StatusCode <> 200 then
    Write-Debug loo_SbJson.GetAsString()
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_SbJson
    return
end if

loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbJson)
loo_JResp.EmitCompact = 0
Write-Debug loo_JResp.Emit()

// Sample output:

// Use this online tool to generate parsing code from sample JSON: 
// Generate Parsing Code from JSON

// {
//   "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('4ee732c3-322e-4a6b-b729-2fd1eb5c6004')/contacts",
//   "value": [
//     {
//       "@odata.etag": "W/\"EQAAABYAAABUcG0qWqkmQYqWLHQataQxAAD0iYfT\"",
//       "id": "AAMkADYzZWE3YmZmLWU0YzgtNGNkZC04MGE1LWFiYTFlNTRlY2QwYQBGAAAAAAAu7cUXL5YOTrdsUIw7-v8FBwBUcG0qWqkmQYqWLHQataQxAAAAAAEOAABUcG0qWqkmQYqWLHQataQxAAD0sxexAAA=",
//       "createdDateTime": "2021-06-29T16:32:05Z",
//       "lastModifiedDateTime": "2021-06-29T16:32:06Z",
//       "changeKey": "EQAAABYAAABUcG0qWqkmQYqWLHQataQxAAD0iYfT",
//       "categories": [
//       ],
//       "parentFolderId": "AAMkADYzZWE3YmZmLWU0YzgtNGNkZC04MGE1LWFiYTFlNTRlY2QwYQAuAAAAAAAu7cUXL5YOTrdsUIw7-v8FAQBUcG0qWqkmQYqWLHQataQxAAAAAAEOAAA=",
//       "birthday": null,
//       "fileAs": "",
//       "displayName": "Pavel Bansky",
//       "givenName": "Pavel",
//       "initials": null,
//       "middleName": null,
//       "nickName": null,
//       "surname": "Bansky",
//       "title": null,
//       "yomiGivenName": null,
//       "yomiSurname": null,
//       "yomiCompanyName": null,
//       "generation": null,
//       "imAddresses": [
//       ],
//       "jobTitle": null,
//       "companyName": null,
//       "department": null,
//       "officeLocation": null,
//       "profession": null,
//       "businessHomePage": null,
//       "assistantName": null,
//       "manager": null,
//       "homePhones": [
//       ],
//       "mobilePhone": null,
//       "businessPhones": [
//         "+1 732 555 0102"
//       ],
//       "spouseName": null,
//       "personalNotes": "",
//       "children": [
//       ],
//       "emailAddresses": [
//         {
//           "name": "Pavel Bansky",
//           "address": "pavelb@fabrikam.onmicrosoft.com"
//         }
//       ],
//       "homeAddress": {},
//       "businessAddress": {},
//       "otherAddress": {}
//     },
// ...
//   ]
// }

ls_Odata_context = loo_JResp.StringOf("~"@odata.context~"")
i = 0
li_Count_i = loo_JResp.SizeOfArray("value")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Odata_etag = loo_JResp.StringOf("value[i].~"@odata.etag~"")
    ls_Id = loo_JResp.StringOf("value[i].id")
    ls_CreatedDateTime = loo_JResp.StringOf("value[i].createdDateTime")
    ls_LastModifiedDateTime = loo_JResp.StringOf("value[i].lastModifiedDateTime")
    ls_ChangeKey = loo_JResp.StringOf("value[i].changeKey")
    ls_ParentFolderId = loo_JResp.StringOf("value[i].parentFolderId")
    ls_Birthday = loo_JResp.StringOf("value[i].birthday")
    ls_FileAs = loo_JResp.StringOf("value[i].fileAs")
    ls_DisplayName = loo_JResp.StringOf("value[i].displayName")
    ls_GivenName = loo_JResp.StringOf("value[i].givenName")
    ls_Initials = loo_JResp.StringOf("value[i].initials")
    ls_MiddleName = loo_JResp.StringOf("value[i].middleName")
    ls_NickName = loo_JResp.StringOf("value[i].nickName")
    ls_Surname = loo_JResp.StringOf("value[i].surname")
    ls_Title = loo_JResp.StringOf("value[i].title")
    ls_YomiGivenName = loo_JResp.StringOf("value[i].yomiGivenName")
    ls_YomiSurname = loo_JResp.StringOf("value[i].yomiSurname")
    ls_YomiCompanyName = loo_JResp.StringOf("value[i].yomiCompanyName")
    ls_Generation = loo_JResp.StringOf("value[i].generation")
    ls_JobTitle = loo_JResp.StringOf("value[i].jobTitle")
    ls_CompanyName = loo_JResp.StringOf("value[i].companyName")
    ls_Department = loo_JResp.StringOf("value[i].department")
    ls_OfficeLocation = loo_JResp.StringOf("value[i].officeLocation")
    ls_Profession = loo_JResp.StringOf("value[i].profession")
    ls_BusinessHomePage = loo_JResp.StringOf("value[i].businessHomePage")
    ls_AssistantName = loo_JResp.StringOf("value[i].assistantName")
    ls_Manager = loo_JResp.StringOf("value[i].manager")
    ls_MobilePhone = loo_JResp.StringOf("value[i].mobilePhone")
    ls_SpouseName = loo_JResp.StringOf("value[i].spouseName")
    ls_PersonalNotes = loo_JResp.StringOf("value[i].personalNotes")
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("value[i].categories")
    do while j < li_Count_j
        loo_JResp.J = j
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("value[i].imAddresses")
    do while j < li_Count_j
        loo_JResp.J = j
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("value[i].homePhones")
    do while j < li_Count_j
        loo_JResp.J = j
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("value[i].businessPhones")
    do while j < li_Count_j
        loo_JResp.J = j
        ls_StrVal = loo_JResp.StringOf("value[i].businessPhones[j]")
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("value[i].children")
    do while j < li_Count_j
        loo_JResp.J = j
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("value[i].emailAddresses")
    do while j < li_Count_j
        loo_JResp.J = j
        ls_Name = loo_JResp.StringOf("value[i].emailAddresses[j].name")
        ls_Address = loo_JResp.StringOf("value[i].emailAddresses[j].address")
        j = j + 1
    loop
    i = i + 1
loop


destroy loo_Http
destroy loo_JsonToken
destroy loo_SbJson
destroy loo_JResp

 

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