PHP code example of totalcrm / microsoft-graph-bundle

1. Go to this page and download the library: Download totalcrm/microsoft-graph-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

totalcrm / microsoft-graph-bundle example snippets


$bundles = [
    ...,
    New TotalCRM\MicrosoftGraph\MicrosoftGraphBundle(),
];

return [
    ...,
    TotalCRM\MicrosoftGraph\MicrosoftGraphBundle::class => ['all' => true],
];
 php
    /** @var MicrosoftGraphContactManager $contactManager */
    $contactManager = $container->get('microsoft_graph.contact_manager');
    
    //Get Contacts by Folder
    /** @var Microsoft\Graph\Model\Contact[] $folders */
    $folders = $contactManager->getContactFolders();
    dump($contacts);

    foreach ($folders as $folder) {
        /** @var Microsoft\Graph\Model\Contact[] $contacts */
        $contacts = $contactManager->getContacts($folder->getId());
        dump($contacts);
    }

    //Get All Contacts 
    /** @var Microsoft\Graph\Model\Contact[] $contacts */
    $contacts = $contactManager->getContacts();
    dump($contacts);
 php
    $id = '...';
    $contact = $contactManager->getContact($id);
    dump($contacts);
 php
    $id = '...';
    $updateEvent = new Microsoft\Graph\Model\Event(); 
    $updateEvent->setId($id);
    $updateEvent->setSubject("I Forgot The Eggs!");
    $event = $calendarManager->updateEvent($updateEvent);
 php
    $id='...';
    $response = $calendar->deleteEvent($id);
    dump($response->getStatus()==204 ? "Event deleted" : $response);