How to create event in Outlook calendar api php? RRS feed

  • Question

  • What have I done?

    Step 1: Create an API account (

    Click on "Add an app" and put a name to your app.

    Click on "Generate New Password" and copy the password

    Step 2: Login or Connect Outlook Calendar API PHP 

    Get Access Token & Refresh Token

    Step 3: Get All Outlook Calendar Events via php Successfully.

    Here My Question: 

    1. How to create calender in Outlook calendar api via php?

    2. How to create event in Outlook calendar api via php?

    I have tried create new calendar below example code

    //echo '<pre>'; print_r($_SESSION); die;

    $access_token  = trim($_SESSION['access_token']);
    $user_email = trim($_SESSION['user_email']);

    $url = "";

    $response = OutlookService::addCalendar($access_token, "Social Checkout", $_SESSION['user_email']);

    echo '<br>---------------<br>';
    echo '<pre>'; print_r($response); die;


    /*$headers = array( "Authorization:Bearer ".$access_token, "Content-Type:application/json" );

    $arrPostField = array( "Name" => "Social Checkout" );

    $eventPayload = json_encode($arrPostField);
    echo $url;

    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $eventPayload);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    $response = curl_exec($curl);
    echo $response;

    $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    echo $httpCode;*/


    Don't Create Outlook New calendar. Because showing error (Access denied & 403).  So, any one know that issue let me know & guide to me.

    Wednesday, August 9, 2017 6:22 AM

All replies

  • Hello,

    This forum is for Outlook Object Model. I would move this thread into Office 365 for developers forum as you are using Office 365 REST API. Sorry for any inconveninence.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, August 10, 2017 1:58 AM
  • Hi Celeste,

                First I will say to Thanks so much for your quick reply. I am new to office 365 outlook api.

    Thanks & Regards,

    A. Senraj.

    Thursday, August 10, 2017 7:34 AM