clpt / microsoftgraph-laravel

Laravel 对微软 Graph API 的包装器

dev-main 2023-02-03 10:20 UTC

This package is auto-updated.

Last update: 2024-09-30 01:54:31 UTC


README

此包允许您将微软 Graph API(事件)连接到用户的 365 个人资料,以创建日历事件

示例用例

use Carbon\Carbon;
use Clpt\MicrosoftGraph\MicrosoftGraph;
use Clpt\MicrosoftGraph\Requests\CreateBody;
use Clpt\MicrosoftGraph\Requests\CreateCalendarEvent;
use Clpt\MicrosoftGraph\Requests\CreateEnd;
use Clpt\MicrosoftGraph\Requests\CreateLocation;
use Clpt\MicrosoftGraph\Requests\CreateStart;

 $calendar = new CreateCalendarEvent(
                    subject: 'Example Subject',
                    start: new CreateStart(
                        dateTime: \Carbon\Carbon::now()->format('Y-m-d\TH:i:s'),
                        timezone: config('app.timezone'),
                    ),
                    end: new CreateEnd(
                        dateTime: \Carbon\Carbon::now()->addDay()->format('Y-m-d\TH:i:s'),
                        timezone: config('app.timezone'),
                    ),
                    body: new CreateBody(
                        content: "<b>Example event content</b>"
                    ),
                    location: new CreateLocation());
                    
                    //adds ability for online teams meetings
            
                    $calendar->setOnlineMeeting();
                    $calendar->setAttendees(['test@gmail.com' , 'test2@gmail.com']);
               
                    //sends the data with guzzle
                    MicrosoftGraph::event($calendar, config("microsoftgraph.uuid"), config("microsoftgraph.key"));