2

I have been struggling with the php api for Google Calendar for weeks now. I have already managed to add and read events with the api and now I'm trying to get Extended Properies to work. I have tried two different ways of adding them to my events:
1:

$extProp = New Google_EventExtendedProperties('test', 'test');
$event->setExtendedProperty($extProps);

2:

$extProp = New Google_EventExtendedProperties('test', 'test');
$event->ExtendedProperty = $extProps;

Both don't give me errors, but I'm not sure if it's working. I tried to read the events with the get method as well as with the list method wich are both described in the documentation of the api, but I can't get my extended properties.

Does anyone know how extended properties work with php?

Eschon
  • 538
  • 7
  • 26

2 Answers2

3

I finally managed to do it. I used the following code:

$extendedProperties = New Google_EventExtendedProperties();
$extendedProperties->setShared(array('custom'=>'blalblabla'));
$event->setExtendedProperties($extendedProperties); 
Eschon
  • 538
  • 7
  • 26
  • 1
    Thanks for the tip. That's different from the api v1. If you want a unique extended property per event, then you should use setPrivate() function. – Jinzhao Huo May 19 '14 at 06:07
0

$extendedProperties = New Google_EventExtendedProperties();

should be changed to:

$extendedProperties = new Google_Service_Calendar_EventExtendedProperties();
rePhat
  • 314
  • 3
  • 9