views:

87

answers:

1

Hi,

I am using zendgdata library for google calendar.

I am getting this error while using this function createQuickAddEvent(it add events to the the google calendar).

Code of this function is:

/**
 * Creates an event on the authenticated user's default calendar using 
 * the specified QuickAdd string.
 *
 * @param Zend_Http_Client $client The authenticated client object
 * @param string $quickAddText The QuickAdd text for the event
 * @return string The ID URL for the event
 */
function createQuickAddEvent ($client, $quickAddText) {
    $gdataCal = new Zend_Gdata_Calendar($client);
    $event = $gdataCal->newEventEntry();
    $event->content = $gdataCal->newContent($quickAddText);
    $event->quickAdd = $gdataCal->newQuickAdd(true);

    $newEvent = $gdataCal->insertEvent($event);
    return $newEvent->id->text;
    }

Error: Expected response code 200, got 403

May be this is due to the fact i have not loaded google calendar(setting timezone first time when you click google calendar). After loading google calendar this error never comes.But i want a solution to this.This thing should never happen with a new user.

Please help me

Thanks.

+2  A: 

EDIT: Okay, I think I'd completely misunderstood you.

Do you mean you want to add an event to a calendar but the calendar doesn't even exist yet? No, you can't do that. The user will have to sign up to Google Calendar before you can try to use it.

Apart from anything else, creating a calendar involves the user agreeing to terms of service and a privacy policy. While we may have some way of automating all that - probably for validated partners, where we'd check that the application asked for the same consent - I highly doubt that it's available through Gdata.

Jon Skeet
Pankaj Khurana
Yes, you're passing in a client object - but has it been authenticated? See http://framework.zend.com/manual/en/zend.gdata.authsub.html for explicit authsub authentication.
Jon Skeet
Thanks once again i just want to confirm whether a user should configure google calendar first in order to create events through my application without any errors.
Pankaj Khurana
Hang on... editing my answer.
Jon Skeet
Thanks for your reply got my answer
Pankaj Khurana