php - Microsoft Graph Delta Query -
i have problem synchronizing events outlook.live.com calendar using php library microsoft graph .
when delta query new events added outlook calendar, instead of returning new events, receive deleted events.
my query:
/beta/users/{userid}/calendars/{calendarid}=/calendarview/delta?$deltatoken={deltatoken}
response got:
array(3) { ["@odata.context"]=> string(60) "https://graph.microsoft.com/beta/$metadata#collection(event)" ["@odata.deltalink"]=> string(523) "https://graph.microsoft.com/beta/users/{userid}/calendars/{calendarid}/calendarview/delta?$deltatoken=vlobdbmaw0qt42orhn1p_k-qpjgwepylqd3oqnzd4oq1x-2qdilwt6qcenoj4pg1sircy2xwwoewx909sipaxkdt1f5_hvmieov401e2_sruq37btknelpw5ocmqh0ye1xvjpnl78lpmnlg17djaxyyy-shwwf9-e0r1dkdtqm27oc3cpef7wrstqcicfyjrzrmvgaefdo4fnrsixeqyij5ui88_-iza5wtinffpwme.s-fenjlawgt-dds6bzo3mahc9v1na9bn8l3y7ysc9xk" ["value"]=> array(1) { [0]=> array(3) { ["@odata.type"]=> string(22) "#microsoft.graph.event" ["id"]=> string(140) "aqmkadawatnizmyazc1jngi4ltlknjctmdacltawcgbgaaadufkn5zrcbeu9_npar0cgnqcahvevimrrmu6xeww1vqdblaaaaneic7oaaaadv5wiytextretddw_onuuaaecoeu1aaaa" ["@removed"]=> array(1) { ["reason"]=> string(7) "deleted" } } } }
my code looks this:
$pdo=new pdo("mysql:host=10.0.2.200;port=3306;dbname=$db", {your username},{your password},array(pdo::mysql_attr_init_command => "set names 'utf8'")); $query="select * sync_data id=$id"; $stmt=$pdo->prepare($query); $stmt->execute(); while($val= $stmt->fetch(pdo::fetch_assoc)){ if ($val["syncto"]=='outlook'){ $accesstoken=new token\accesstoken(json_decode($val["accesstoken"],true)); $deltalink=$val["synctoken"]; $calendarid=$val["calendarid"]; } } $graph=new microsoft\graph\graph(); $graph->setaccesstoken($accesstoken); $response = $graph->createrequest("get", $deltalink) ->addheaders(array ("prefer"=>"outlook.body-content-type='text'")) ->execute(); $response=$response->getbody(); var_dump($response);
i found out id provided in response removed event id of created event , o'm capable of pulling event details request this:
$url = "/me/calendars/$calendarid/events/aqmkadawatnizmyazc1jngi4ltlknjctmdacltawcgbgaaadufkn5zrcbeu9_npar0cgnqcahvevimrrmu6xeww1vqdblaaaaneic7oaaaadv5wiytextretddw_onuuaaecoeu1aaaa"; $response = $graph->createrequest("get", $url) ->addheaders(array ("prefer"=>"outlook.body-content-type='text'")) ->execute(); $response=$response->getbody();
wiki
Comments
Post a Comment