Skip to content

Commit 13d81aa

Browse files
committed
Planner API new types and methods
1 parent 0514f54 commit 13d81aa

File tree

7 files changed

+75
-11
lines changed

7 files changed

+75
-11
lines changed

examples/Planner/ExportPlans.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/**
4+
*
5+
* Description:
6+
* - List all groups containing Planner plans
7+
* - Identify plans accessible to the specific group
8+
* - Extract all tasks from qualifying plans
9+
*
10+
* Permissions:
11+
* Accessing group plans requires both Group.Read.All and Tasks.Read.All permissions.
12+
*/
13+
14+
15+
use Office365\Directory\Groups\Group;
16+
use Office365\GraphServiceClient;
17+
use Office365\Planner\Plans\PlannerPlan;
18+
19+
require_once '../vendor/autoload.php';
20+
21+
$settings = include('../../tests/Settings.php');
22+
$client = GraphServiceClient::withClientSecret($settings['TenantName'], $settings['ClientId'], $settings['ClientSecret']);
23+
24+
# 1. Get all Microsoft 365 groups (that might contain plans)
25+
$groups = $client->getGroups()->get()->top(10)->filter("groupTypes/any(c:c eq 'Unified')")->executeQuery();
26+
27+
/** @var Group $grp */
28+
foreach ($groups as $grp) {
29+
echo sprintf("\nProcessing group: %s \n", $grp->getProperty("DisplayName"));
30+
$plans = $grp->getPlanner()->getPlans()->get()->executeQuery();
31+
32+
/** @var PlannerPlan $plan */
33+
foreach ($plans as $plan) {
34+
echo sprintf("\tPlan: %s \n", $plan->getProperty("Title"));
35+
}
36+
}
37+
38+
39+

generator/GenerateModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function syncSharePointMetadataFile($fileName){
140140

141141
try {
142142

143-
$modelName = "SharePoint";
143+
$modelName = "MicrosoftGraph";
144144
if (count($argv) > 1)
145145
$modelName = $argv[1];
146146

generator/Settings.SharePoint.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"docsRoot": "https:\/\/docs.microsoft.com\/en-us\/openspecs\/sharepoint_protocols\/ms-csomspt\/",
77
"rootNamespace": "Office365\\SharePoint",
88
"entityRootNamespace": "SP",
9-
"version": "16.0.26330.12011",
10-
"timestamp": "2025-08-15T21:03:47+00:00",
9+
"version": "16.0.26330.12012",
10+
"timestamp": "2025-08-17T09:30:06+00:00",
1111
"placeholder": "Generated ",
1212
"typeMappings": {
1313
"SP.List": "SP.SPList",

src/Planner/Planner.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Office365\Entity;
99
use Office365\Planner\Plans\PlannerPlanCollection;
10+
use Office365\Planner\Tasks\PlannerTaskCollection;
1011
use Office365\Runtime\ResourcePath;
1112

1213
class Planner extends Entity
@@ -16,8 +17,18 @@ class Planner extends Entity
1617
*/
1718
public function getPlans()
1819
{
19-
return $this->getProperty("plans",
20+
return $this->getProperty("Plans",
2021
new PlannerPlanCollection($this->getContext(),
21-
new ResourcePath("plans", $this->getResourcePath()), $this));
22+
new ResourcePath("Plans", $this->getResourcePath()), $this));
23+
}
24+
25+
/**
26+
* @return PlannerTaskCollection
27+
*/
28+
public function getTasks()
29+
{
30+
return $this->getProperty("Tasks",
31+
new PlannerTaskCollection($this->getContext(),
32+
new ResourcePath("Tasks", $this->getResourcePath()), $this));
2233
}
2334
}

src/Planner/PlannerGroup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class PlannerGroup extends Entity
1616
*/
1717
public function getPlans()
1818
{
19-
return $this->getProperty("plans",
19+
return $this->getProperty("Plans",
2020
new PlannerPlanCollection($this->getContext(),
21-
new ResourcePath("plans", $this->getResourcePath()), $this));
21+
new ResourcePath("Plans", $this->getResourcePath()), $this));
2222
}
2323

2424
}

src/Planner/PlannerUser.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ class PlannerUser extends Entity
1818
*/
1919
public function getTasks()
2020
{
21-
return $this->getProperty("tasks",
21+
return $this->getProperty("Tasks",
2222
new PlannerTaskCollection($this->getContext(),
23-
new ResourcePath("tasks", $this->getResourcePath())));
23+
new ResourcePath("Tasks", $this->getResourcePath())));
2424
}
2525

2626
/**
2727
* @return EntityCollection
2828
*/
2929
public function getPlans()
3030
{
31-
return $this->getProperty("plans",
31+
return $this->getProperty("Plans",
3232
new EntityCollection($this->getContext(),
33-
new ResourcePath("plans", $this->getResourcePath()),PlannerPlan::class));
33+
new ResourcePath("Plans", $this->getResourcePath()),PlannerPlan::class));
3434
}
3535
}

src/Planner/Plans/PlannerPlan.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Office365\Directory\Identities\IdentitySet;
99
use Office365\Entity;
10+
use Office365\Planner\Tasks\PlannerTaskCollection;
1011
use Office365\Runtime\Http\RequestOptions;
1112
use Office365\Runtime\ResourcePath;
1213
/**
@@ -81,6 +82,19 @@ public function getDetails()
8182
new PlannerPlanDetails($this->getContext(),new ResourcePath("Details", $this->getResourcePath())));
8283
}
8384

85+
/**
86+
* @return PlannerTaskCollection
87+
*/
88+
public function getTasks()
89+
{
90+
return $this->getProperty("Tasks",
91+
new PlannerTaskCollection($this->getContext(),
92+
new ResourcePath("Tasks", $this->getResourcePath()), $this));
93+
}
94+
95+
/**
96+
* @return $this
97+
*/
8498
public function deleteObject()
8599
{
86100
parent::deleteObject();

0 commit comments

Comments
 (0)