Booking synchronization with Outlook Calendar

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815

Implementing booking synchronization with Outlook Calendar

Outlook Calendar is a standard in corporate environments. Booking synchronization with Outlook is relevant for B2B services, consulting, medical clinics where specialists work in Microsoft 365.

Microsoft Graph API

Outlook Calendar is managed via Microsoft Graph API. Authorization through Microsoft Identity Platform (Azure AD):

use Microsoft\Graph\Graph;
use Microsoft\Graph\Model\Event as GraphEvent;

class OutlookCalendarService
{
    private Graph $graph;

    public function __construct(string $accessToken)
    {
        $this->graph = new Graph();
        $this->graph->setAccessToken($accessToken);
    }

    public function createEvent(Booking $booking): string
    {
        $event = new GraphEvent();
        $event->setSubject("{$booking->service->name} — {$booking->customer_name}");
        $event->setBody([
            'contentType' => 'HTML',
            'content'     => $this->buildHtmlBody($booking),
        ]);
        $event->setStart([
            'dateTime' => $booking->starts_at->toIso8601String(),
            'timeZone' => 'Russian Standard Time',
        ]);
        $event->setEnd([
            'dateTime' => $booking->ends_at->toIso8601String(),
            'timeZone' => 'Russian Standard Time',
        ]);

        $created = $this->graph
            ->createRequest('POST', '/me/events')
            ->attachBody($event)
            ->setReturnType(GraphEvent::class)
            ->execute();

        return $created->getId();
    }
}

OAuth2 flow for Microsoft 365

Register your application in Azure Portal, scope Calendars.ReadWrite:

Route::get('/integrations/outlook/connect', function () {
    $url = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize?' .
        http_build_query([
            'client_id'     => config('services.microsoft.client_id'),
            'scope'         => 'Calendars.ReadWrite offline_access',
            'redirect_uri'  => route('integrations.outlook.callback'),
            'response_type' => 'code',
        ]);

    return redirect($url);
});

Differences from Google Calendar

  • Uses Microsoft Graph, not Calendar API
  • Time zones are passed by Windows name (Russian Standard Time, not Europe/Moscow)
  • For enterprise accounts, authorization via Tenant ID, not common
  • Microsoft Graph Webhooks for changes work via subscriptions with mandatory validation challenge

Timeline

Synchronization with Outlook Calendar via Microsoft Graph: 3–5 working days.