PHP code example of codebar-ag / laravel-microsoft-planner
1. Go to this page and download the library: Download codebar-ag/laravel-microsoft-planner 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/ */
codebar-ag / laravel-microsoft-planner example snippets
use CodebarAg\LaravelMicrosoftPlanner\Http\Connectors\MicrosoftPlannerConnector;
use CodebarAg\LaravelMicrosoftPlanner\Http\Requests\Bucket\GetBucketTasksRequest;
use CodebarAg\LaravelMicrosoftPlanner\Http\Requests\Tasks\GetTaskRequest;
use CodebarAg\LaravelMicrosoftPlanner\Http\Requests\Tasks\GetTaskDetailsRequest;
use CodebarAg\LaravelMicrosoftPlanner\Http\Requests\Tasks\PatchTaskRequest;
use CodebarAg\LaravelMicrosoftPlanner\Http\Requests\Tasks\PatchTaskDetialsRequest;
$connector = new MicrosoftPlannerConnector();
$authenticator = $connector->getAccessToken();
$connector->authenticate($authenticator);
// Get all tasks from a bucket
$tasksResponse = $connector->send(new GetBucketTasksRequest(bucketId: 'bucket-id'));
$tasks = $tasksResponse->dto();
// Get a single task
$taskResponse = $connector->send(new GetTaskRequest(taskId: 'task-id'));
$task = $taskResponse->dto();
// Get a tasks details
$taskDetailsResponse = $connector->send(new GetTaskDetailsRequest(taskId: 'task-id'));
$taskDetails = $taskDetailsResponse->dto();
// Update a task
$updateTaskRequest = new PatchTaskRequest(taskId: 'task-id', etag: $task->eTag);
$updateTaskRequest->body()->add('somedetail', 'somevalue');
$updateTaskResponse = $connector->send($updateTaskRequest);
if ($updatedTask->successful()) {
// Do something
}
// Update a tasks details
$updateTaskDetailsRequest = new PatchTaskDetialsRequest(taskId: 'task-id', etag: $taskDetails->eTag);
$updateTaskDetailsRequest->body()->add('somedetail', 'somevalue');
$updateTaskDetailsResponse = $connector->send($updateTaskDetailsRequest);
if ($updatedTaskDetails->successful()) {
// Do something
}