1

How do I get Outlook events calendar and sync with PHP calendar?

I have tried this:

var req = new XMLHttpRequest();
req.open("POST", "https://graph.microsoft.com/v1.0/me/events");
req.setRequestHeader("authorization", "Bearer " + accessToken);
req.setRequestHeader("content-type", "application/json");
req.onload = function (e) {
    if (req.readyState === 4) {
        // Check if the get was successful
        if (req.status === 201) {
            console.log(req.response);
        }
    }
};
req.onerror = function (e) {
    // Catching errors
};
req.send(jsonData);

Any idea about the PHP example?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Vijay
  • 31
  • 1
  • 4
  • This looks like javascript. what have you tried in PHP? – JoSSte Nov 19 '18 at 06:38
  • no idea about php code, if you have idea about it, please suggest it. – Vijay Nov 19 '18 at 06:41
  • 1
    i have loads of idea, but why are you showing javascript code in a PHP question? have you tried to search SO for "call rest service from PHP"? a quick search brings up https://stackoverflow.com/questions/9802788/call-a-rest-api-in-php I am just trying to figure out what you are actually asking. – JoSSte Nov 19 '18 at 06:44
  • My question is i want to sync outlook calendar events to my PHP calendar. – Vijay Nov 19 '18 at 07:10

1 Answers1

2

If you want get Outlook calendar events to sync with PHP calendar, you need to specify the Prefer: odata.track-changes header in all sync requests except those that include a skipToken that is returned from a previous sync request.

For more information, you could refer to the below link:

Sync events

Alina Li
  • 884
  • 1
  • 6
  • 5