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
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
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
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
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(PowerBuilder) Retrieve the metadata for a DriveItem

Fetches the JSON metadata for a DriveItem.

For more information, see https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get?view=odsp-graph-online

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_Http
string ls_MetaData
oleobject loo_Json
integer li_Success
string ls_Odata_context
string ls_Microsoft_graph_downloadUrl
string ls_CreatedDateTime
string ls_CTag
string ls_ETag
string ls_Id
string ls_LastModifiedDateTime
string ls_Name
integer li_Size
string ls_WebUrl
integer li_RatingRating
integer li_RatingSimpleRating
string ls_CreatedByUserDisplayName
string ls_CreatedByUserId
string ls_LastModifiedByUserDisplayName
string ls_LastModifiedByUserId
string ls_ParentReferenceDriveId
string ls_ParentReferenceDriveType
string ls_ParentReferenceId
string ls_ParentReferenceName
string ls_ParentReferencePath
string ls_FileMimeType
string ls_FileHashesSha1Hash
string ls_FileSystemInfoCreatedDateTime
string ls_FileSystemInfoLastModifiedDateTime
integer li_ImageHeight
integer li_ImageWidth
string ls_PhotoTakenDateTime
string ls_SharedScope
string ls_SharedOwnerUserDisplayName
string ls_SharedOwnerUserId

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

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.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:
// See the following examples for getting an access token:
//    Get Microsoft Graph OAuth2 Access Token (Azure AD v2.0 Endpoint).
//    Get Microsoft Graph OAuth2 Access Token (Azure AD Endpoint).
//    Refresh Access Token (Azure AD v2.0 Endpoint).
//    Refresh Access Token (Azure AD Endpoint).

// (Make sure your token was obtained with the FilesRead or Files.ReadWrite scope.)
loo_Http.AuthToken = "MICROSOFT_GRAPH_ACCESS_TOKEN"

// Sends the following GET request:
// GET https://graph.microsoft.com/v1.0/me/drive/root:/{item-path}

// Make sure to automatically follow redirects
loo_Http.FollowRedirects = 1

// This example will get the metadata for /Misc/wildlife/penguins.jpg
loo_Http.SetUrlVar("item_path","Misc/wildlife/penguins.jpg")

ls_MetaData = loo_Http.QuickGetStr("https://graph.microsoft.com/v1.0/me/drive/root:/{$item_path}")
if loo_Http.LastMethodSuccess <> 1 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    return
end if

loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_Json.EmitCompact = 0
li_Success = loo_Json.Load(ls_MetaData)
Write-Debug loo_Json.Emit()

// Sample JSON metadata result:

// {
//   "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('admin%40chilkat.io')/drive/root/$entity",
//   "@microsoft.graph.downloadUrl": "https://public.dm.files.1drv.com/y4mh0z_Og97O7Q...o2q1HhNBU",
//   "createdDateTime": "2017-06-04T20:40:22.48Z",
//   "cTag": "aYzozQTMzRkNFQjlCNzRDQzE1ITQ4NzIuMjU3",
//   "eTag": "aM0EzM0ZDRUI5Qjc0Q0MxNSE0ODcyLjY",
//   "id": "3A33FCEB9B74CC15!4872",
//   "lastModifiedDateTime": "2018-10-20T18:22:29.977Z",
//   "name": "penguins.jpg",
//   "size": 777835,
//   "webUrl": "https://1drv.ms/i/s!ABXMdJvr_DM6pgg",
//   "rating": {
//     "rating": 75,
//     "simpleRating": 4
//   },
//   "createdBy": {
//     "user": {
//       "displayName": "Joe Programmer",
//       "id": "3a33fceb9b74cc15"
//     }
//   },
//   "lastModifiedBy": {
//     "user": {
//       "displayName": "Joe Programmer",
//       "id": "3a33fceb9b74cc15"
//     }
//   },
//   "parentReference": {
//     "driveId": "3a33fceb9b74cc15",
//     "driveType": "personal",
//     "id": "3A33FCEB9B74CC15!4871",
//     "name": "wildlife",
//     "path": "/drive/root:/Misc/wildlife"
//   },
//   "file": {
//     "mimeType": "image/jpeg",
//     "hashes": {
//       "sha1Hash": "DF7BE9DC4F467187783ACA68C7CE98E4DF2172D0"
//     }
//   },
//   "fileSystemInfo": {
//     "createdDateTime": "2017-06-04T20:40:22.48Z",
//     "lastModifiedDateTime": "2009-07-14T05:32:31.674Z"
//   },
//   "image": {
//     "height": 768,
//     "width": 1024
//   },
//   "photo": {
//     "takenDateTime": "2008-02-18T05:07:31Z"
//   },
//   "shared": {
//     "scope": "users",
//     "owner": {
//       "user": {
//         "displayName": "Joe Programmer",
//         "id": "3a33fceb9b74cc15"
//       }
//     }
//   }
// }
// 

// If the response status code was not 200, then it failed.
if loo_Http.LastStatus <> 200 then
    Write-Debug "Response Status Code = " + string(loo_Http.LastStatus)
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_Json
    return
end if

// Demonstrate how to parse the JSON...

ls_Odata_context = loo_Json.StringOf("\"@odata.context\"")
ls_Microsoft_graph_downloadUrl = loo_Json.StringOf("\"@microsoft.graph.downloadUrl\"")
ls_CreatedDateTime = loo_Json.StringOf("createdDateTime")
ls_CTag = loo_Json.StringOf("cTag")
ls_ETag = loo_Json.StringOf("eTag")
ls_Id = loo_Json.StringOf("id")
ls_LastModifiedDateTime = loo_Json.StringOf("lastModifiedDateTime")
ls_Name = loo_Json.StringOf("name")
li_Size = loo_Json.IntOf("size")
ls_WebUrl = loo_Json.StringOf("webUrl")
li_RatingRating = loo_Json.IntOf("rating.rating")
li_RatingSimpleRating = loo_Json.IntOf("rating.simpleRating")
ls_CreatedByUserDisplayName = loo_Json.StringOf("createdBy.user.displayName")
ls_CreatedByUserId = loo_Json.StringOf("createdBy.user.id")
ls_LastModifiedByUserDisplayName = loo_Json.StringOf("lastModifiedBy.user.displayName")
ls_LastModifiedByUserId = loo_Json.StringOf("lastModifiedBy.user.id")
ls_ParentReferenceDriveId = loo_Json.StringOf("parentReference.driveId")
ls_ParentReferenceDriveType = loo_Json.StringOf("parentReference.driveType")
ls_ParentReferenceId = loo_Json.StringOf("parentReference.id")
ls_ParentReferenceName = loo_Json.StringOf("parentReference.name")
ls_ParentReferencePath = loo_Json.StringOf("parentReference.path")
ls_FileMimeType = loo_Json.StringOf("file.mimeType")
ls_FileHashesSha1Hash = loo_Json.StringOf("file.hashes.sha1Hash")
ls_FileSystemInfoCreatedDateTime = loo_Json.StringOf("fileSystemInfo.createdDateTime")
ls_FileSystemInfoLastModifiedDateTime = loo_Json.StringOf("fileSystemInfo.lastModifiedDateTime")
li_ImageHeight = loo_Json.IntOf("image.height")
li_ImageWidth = loo_Json.IntOf("image.width")
ls_PhotoTakenDateTime = loo_Json.StringOf("photo.takenDateTime")
ls_SharedScope = loo_Json.StringOf("shared.scope")
ls_SharedOwnerUserDisplayName = loo_Json.StringOf("shared.owner.user.displayName")
ls_SharedOwnerUserId = loo_Json.StringOf("shared.owner.user.id")


destroy loo_Http
destroy loo_Json

 

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