1. Go to this page and download the library: Download hwkdo/ms-graph-laravel 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/ */
hwkdo / ms-graph-laravel example snippets
// database/seeders/DatabaseSeeder.php
public function run(): void
{
$this->call([
\Hwkdo\MsGraphLaravel\Database\Seeders\GraphWebhookJobMappingSeeder::class,
]);
}
use Hwkdo\MsGraphLaravel\Services\MailboxService;
$mailboxService = app(MailboxService::class);
// E-Mails abrufen, senden und verwalten
use Hwkdo\MsGraphLaravel\Services\OneDriveService;
$oneDriveService = app(OneDriveService::class);
// Dateien hochladen, herunterladen und verwalten
use Hwkdo\MsGraphLaravel\Services\OutOfOfficeTemplateService;
$oooService = app(OutOfOfficeTemplateService::class);
// Abwesenheitsvorlagen erstellen und verwalten
use Hwkdo\MsGraphLaravel\Models\GraphWebhookJobMapping;
// Alle aktiven Subscriptions
$subscriptions = GraphWebhookJobMapping::getActiveSubscriptions();
// Subscription nach Typ
$jobClass = GraphWebhookJobMapping::getJobClassForType('intracollect');
// Subscription nach Resource und URL
$subscription = GraphWebhookJobMapping::findByResourceAndNotificationUrl(
"/users/[email protected]/mailFolders('inbox')/messages",
'https://portal.hwkdo.com/api/kunden/ms-graph-subscription/intracollect'
);
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class ProcessMyWebhook implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct(
public string $resource
) {}
public function handle(): void
{
// Verarbeite die Webhook-Daten
// $this->resource enthält die Microsoft Graph Resource ID
}
}