DataFlex
DataFlex
Delete a Task List
See more Google Tasks Examples
Demonstrates how to delete a Google task list.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoFac
String sAccessToken
Handle hoHttp
Variant vResp
Handle hoResp
String sTemp1
Integer iTemp1
Boolean bTemp1
Move False To iSuccess
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// Get the previously obtained access token.
// See Get Google Tasks Access Token.
Get Create (RefClass(cComCkFileAccess)) To hoFac
If (Not(IsComObjectCreated(hoFac))) Begin
Send CreateComObject of hoFac
End
Get ComReadEntireTextFile Of hoFac "qa_data/tokens/googleTasks.txt" "utf-8" To sAccessToken
Get ComLastMethodSuccess Of hoFac To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoFac To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Set ComAuthToken Of hoHttp To sAccessToken
// Delete the task list with this ID: MDM4MzQ4NTA3NDQwMDUxMzQ2OTQ6OTk5Njk3NjkxNzg4Nzg2NDow
Get ComSetUrlVar Of hoHttp "taskListId" "MDM4MzQ4NTA3NDQwMDUxMzQ2OTQ6OTk5Njk3NjkxNzg4Nzg2NDow" To iSuccess
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
If (Not(IsComObjectCreated(hoResp))) Begin
Send CreateComObject of hoResp
End
Get pvComObject of hoResp to vResp
Get ComHttpNoBody Of hoHttp "DELETE" "https://www.googleapis.com/tasks/v1/users/@me/lists/{$taskListId}" vResp To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
// Show the response body. (empty for success)
Get ComBodyStr Of hoResp To sTemp1
Showln sTemp1
// Examine the response status code. (204 = success)
Get ComStatusCode Of hoResp To iTemp1
Showln "response status code: " iTemp1
End_Procedure