(AutoIt) List all Labels in the User's Mailbox
List all Labels in the GMail User's Mailbox
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
Local $bSuccess
$oHttp = ObjCreate("Chilkat.Http")
$oHttp.AuthToken = "GMAIL-ACCESS-TOKEN"
Local $sUserId = "me"
$oHttp.SetUrlVar("userId",$sUserId)
Local $sUrl = "https://www.googleapis.com/gmail/v1/users/{$userId}/labels"
$oHttp.SessionLogFilename = "c:/temp/qa_output/sessionLog.txt"
; Get the list of GMail labels as JSON.
$oSb = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oHttp.QuickGetSb($sUrl,$oSb)
If ($bSuccess <> True) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.LoadSb($oSb)
$oJson.EmitCompact = False
ConsoleWrite($oJson.Emit() & @CRLF)
If ($oHttp.LastStatus <> 200) Then
ConsoleWrite("Failed." & @CRLF)
Exit
EndIf
|