Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Get a List of Message IDs in GMail User's MailboxDemonstrates how to get a list of message IDs in a GMail mailbox. The "userId" can be either the user's email address or the special value "me" to indicate the authenticated user. For more information, see https://developers.google.com/gmail/api/v1/reference/users/messages/list
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Variant vResp Handle hoResp Handle hoJsonResponse Boolean iSuccess String sId String sThreadId Integer iResultSizeEstimate Integer i Integer iCount_i String sTemp1 Integer iTemp1 Boolean bTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End Set ComAuthToken Of hoHttp To "ACCESS_TOKEN" Set ComAccept Of hoHttp To "application/json" Get ComQuickRequest Of hoHttp "GET" "https://www.googleapis.com/gmail/v1/users/userId/messages" To vResp If (IsComObject(vResp)) Begin Get Create (RefClass(cComChilkatHttpResponse)) To hoResp Set pvComObject Of hoResp To vResp End Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get ComStatusCode Of hoResp To iTemp1 Showln "Response Status Code: " iTemp1 Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse If (Not(IsComObjectCreated(hoJsonResponse))) Begin Send CreateComObject of hoJsonResponse End Get ComBodyStr Of hoResp To sTemp1 Get ComLoad Of hoJsonResponse sTemp1 To iSuccess Set ComEmitCompact Of hoJsonResponse To False Get ComEmit Of hoJsonResponse To sTemp1 Showln sTemp1 Get ComStatusCode Of hoResp To iTemp1 If (iTemp1 <> 200) Begin Showln "Failed." Send Destroy of hoResp Procedure_Return End Send Destroy of hoResp // { // "messages": [ // users.messages Resource // ], // "nextPageToken": string, // "resultSizeEstimate": unsigned integer // } Get ComIntOf Of hoJsonResponse "resultSizeEstimate" To iResultSizeEstimate Move 0 To i Get ComSizeOfArray Of hoJsonResponse "messages" To iCount_i While (i < iCount_i) Set ComI Of hoJsonResponse To i Get ComStringOf Of hoJsonResponse "messages[i].id" To sId Get ComStringOf Of hoJsonResponse "messages[i].threadId" To sThreadId Move (i + 1) To i Loop End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.