none
Need to create event in outlook calendar RRS feed

  • Question

  • Hi,

    Please helpme out asap. I have access token and i am getting error

    { "error": { "code": "ErrorAccessDenied", "message": "Access is denied. Check credentials and try again.", "innerError": { "request-id": "0359f328-03ba-4cc4-8ab3-1e1ea8107ec0", "date": "2018-10-17T05:13:28" } } }

    and my code is
     $url = "https://graph.microsoft.com/beta/me/events";
                $data_json = '{
                    "subject": "Lets go for lunch",
                    "body": {
                      "contentType": "HTML",
                      "content": "Does late morning work for you?"
                    },
                    "start": {
                        "dateTime": "2017-04-15T12:00:00",
                        "timeZone": "Pacific Standard Time"
                    },
                    "end": {
                        "dateTime": "2017-04-15T14:00:00",
                        "timeZone": "Pacific Standard Time"
                    },
                    "location":{
                        "displayName":"Harrys Bar"
                    },
                    "attendees": [
                      {
                        "emailAddress": {
                          "address":"deepikagupta181@hotmail.com",
                          "name": "deepika gupta"
                        },
                        "type": "required"
                      }
                    ]
                  }' ;
                 //print_r($data_json);die;
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
                curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                "Content-Type: application/json",
                "Authorization: Bearer " . $accessToken->getToken(),
                "Content-length: ".strlen($data_json))
                );
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                 $result = curl_exec($ch);
                 echo "<pre>";
                 print_r($result);

    Thanks in advance and your earlier response is highly appreciated

    Wednesday, October 17, 2018 5:23 AM