0

I need to delete an event, what I do is save the ID of the event in a database and then use that url thttpid.delete to remove it, but I get an error 402 forbidden

Code= 'XXXXxxXXXxx' // ClientLogin code
URL:='https://www.google.com/calendar/feeds/XXXX%40gmail.com/private/full/XXXXo8aqjok24794auifouXXXX' // ID GOOGLE EVENT 


    function TForm4.DeleteGoogle(Code,URL:String): String;
    begin
          idHTTP2.IOHandler:=IdSSLIOHandlerSocketOpenSSL1;
          idHTTP2.Request.Connection  := 'Keep-Alive';
          idHTTP2.Request.ContentType := 'application/atom+xml';
          idHTTP2.Request.CustomHeaders.Values['GData-Version']:='2.0';
          idHTTP2.Request.CustomHeaders.Values['Authorization']:=('GoogleLogin Auth='+Code);
          try
            idHTTP2.Delete(URL);
          except on E: EIdHTTPProtocolException do
            idHTTP2.Delete(URL);
          end;
          //ID
             Result:=(IdHTTP2.Response.Location);
    end;

What is the url I need to delete this event?.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

2 Answers2

0

You cannot delete an entry from an RSS Feed. A Feed is read-only, meant for exchanging data across systems. You need to use Google's Calendar API to login to the actual calendar and then delete the desired entry from there.

Google Calendar API v1:

Deleting Events


Google Calendar API v3:

Events

Events: delete

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • Are you sure? According to [google calendar api delphi](http://stackoverflow.com/q/9308260), you can. Has it changed since then? (Not arguing - just asking.) – Ken White May 14 '14 at 22:33
  • I needed to add tidhttp the header 'if-match' and add the tag value, fixed – DeveloperPop May 14 '14 at 23:11
0

I needed to add the header 'if-match' and add the tag value. Doing so fixed the problem.

IdHTTP2.Request.CustomHeaders.Values['If-Match']:=tag;
Ken White
  • 123,280
  • 14
  • 225
  • 444