0

I can't fathom what I'm doing wrong here. I can successfully add a calendar event with "POST" & json data. But I cannot understand what I am doing wrong when it comes to deleting it. I am getting error 401 but I know for a fact I am 100% authenticated with the correct scope.

Help is appreciated.

If TokenExpired = False Then

Dim objhttp As New WinHttp.WinHttpRequest
Set objhttp = CreateObject("WinHttp.WinHttpRequest.5.1")
EID = TheDatabase(InProgramPos).GCalEID
DelUrl = "https://www.googleapis.com/calendar/v3/calendars/primary/events/" & EID

objhttp.open "DELETE", DelUrl
objhttp.send

If objhttp.Status = 401 Then
    MsgBox objhttp.responseText
    TokenExpired = True
    Call GenerateOAuth2Token
End If

after generating a new valid token, I re-run the above code and it continues to error 401 on me.
The EID is correct. Google API states to send anything in the body nor set any headers.

Help is appreicated!

Stavros
  • 23
  • 1
  • 5

1 Answers1

0

Solution to problem.

Google API generates a unique EID in the json response. I was mistaken that the EID was in htmlLink URL section where it says EID= this is not the EID.

Code is working!

Stavros
  • 23
  • 1
  • 5