Skip to content

Commit bb5f0fc

Browse files
Prepare for 2.5 release (model refactorings, simplified way to assign Message recipients)
1 parent b16aed8 commit bb5f0fc

File tree

83 files changed

+169
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+169
-141
lines changed

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ The following example demonstrates how to send a message via Outlook Mail API:
213213
use Office365\OutlookServices\ItemBody;
214214
use Office365\OutlookServices\BodyType;
215215
use Office365\OutlookServices\EmailAddress;
216-
use Office365\OutlookServices\Recipient;
217216
use Office365\Runtime\Auth\AADTokenProvider;
218217
use Office365\Runtime\Auth\UserCredentials;
219218

@@ -232,7 +231,7 @@ $client = new GraphServiceClient("acquireToken");
232231
$message = $client->getMe()->getMessages()->createType();
233232
$message->setSubject("Meet for lunch?");
234233
$message->setBody(new ItemBody(BodyType::Text,"The new cafeteria is open."));
235-
$message->getToRecipients()->addChild(new Recipient(new EmailAddress(null,"[email protected]")));
234+
$message->setToRecipients([new EmailAddress(null,"[email protected]")]);
236235
$client->getMe()->sendEmail($message,true)->executeQuery();
237236
```
238237

examples/Outlook/SendEmail.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Office365\OutlookServices\EmailAddress;
88
use Office365\OutlookServices\ItemBody;
99
use Office365\OutlookServices\Message;
10-
use Office365\OutlookServices\Recipient;
1110
use Office365\Runtime\Auth\AADTokenProvider;
1211
use Office365\Runtime\Auth\UserCredentials;
1312

@@ -28,7 +27,7 @@ function acquireToken()
2827
$message = $client->getMe()->getMessages()->createType();
2928
$message->setSubject("Meet for lunch?");
3029
$message->setBody(new ItemBody(BodyType::Text,"The new cafeteria is open."));
31-
$message->getToRecipients()->addChild(new Recipient(new EmailAddress(null,"[email protected]")));
30+
$message->setToRecipients([new EmailAddress(null,"[email protected]")]);
3231
$client->getMe()->sendEmail($message,false)->executeQuery();
3332

3433

examples/SharePoint/Sites/CreateModernSite.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
require_once __DIR__ . '../../vendor/autoload.php';
4-
$settings = include(__DIR__ . '../../../Settings.php');
4+
$settings = include(__DIR__ . '../../../tests/Settings.php');
55

66
use Office365\Runtime\Auth\ClientCredential;
77
use Office365\Runtime\Http\RequestOptions;

src/Common/User.php

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class User extends DirectoryObject
2727
{
2828

2929
/**
30+
* Send the message specified in the request body. The message is saved in the Sent Items folder by default.
3031
* @param Message $message
3132
* @param bool $saveToSentItems
3233
* @return self

src/OneDrive/Drive.php

+9-11
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,35 @@ class Drive extends BaseItem
1818
*/
1919
public function getDriveType()
2020
{
21-
if (!$this->isPropertyAvailable("DriveType")) {
22-
return null;
23-
}
2421
return $this->getProperty("DriveType");
2522
}
23+
2624
/**
25+
* @return self
2726
* @var string
2827
*/
2928
public function setDriveType($value)
3029
{
3130
$this->setProperty("DriveType", $value, true);
31+
return $this;
3232
}
3333
/**
3434
* @return IdentitySet
3535
*/
3636
public function getOwner()
3737
{
38-
if (!$this->isPropertyAvailable("Owner")) {
39-
$this->setProperty("Owner", new IdentitySet());
40-
}
41-
return $this->getProperty("Owner");
38+
return $this->getProperty("Owner", new IdentitySet());
4239
}
40+
4341
/**
42+
*
43+
* @return self
4444
* @var IdentitySet
4545
*/
4646
public function setOwner($value)
4747
{
4848
$this->setProperty("Owner", $value, true);
49+
return $this;
4950
}
5051
/**
5152
* @return Quota
@@ -86,10 +87,7 @@ public function setSharePointIds($value)
8687
*/
8788
public function getSystem()
8889
{
89-
if (!$this->isPropertyAvailable("System")) {
90-
return null;
91-
}
92-
return $this->getProperty("System");
90+
return $this->getProperty("System", new SystemFacet());
9391
}
9492
/**
9593
* @var SystemFacet

src/OneNote/OnenotePageCollection.php

+6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66

77

88
use Office365\EntityCollection;
9+
use Office365\Runtime\ClientRuntimeContext;
10+
use Office365\Runtime\ResourcePath;
911

1012
class OnenotePageCollection extends EntityCollection
1113
{
14+
public function __construct(ClientRuntimeContext $ctx, ResourcePath $resourcePath = null)
15+
{
16+
parent::__construct($ctx, $resourcePath, OnenotePage::class);
17+
}
1218

1319
}

src/OutlookServices/Event.php

-3
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,6 @@ public function setIsOnlineMeeting($value)
474474
*/
475475
public function getAllowNewTimeProposals()
476476
{
477-
if (!$this->isPropertyAvailable("AllowNewTimeProposals")) {
478-
return null;
479-
}
480477
return $this->getProperty("AllowNewTimeProposals");
481478
}
482479
/**

src/OutlookServices/Message.php

+13-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Message extends OutlookItem
2020

2121
/**
2222
* @param $attachmentType
23-
* @return ItemAttachment|FileAttachment
23+
* @return ItemAttachment|FileAttachment|ReferenceAttachment
2424
*/
2525
public function addAttachment($attachmentType)
2626
{
@@ -394,6 +394,18 @@ public function getToRecipients(){
394394
return $this->getProperty("ToRecipients",new ClientValueCollection(Recipient::class));
395395
}
396396

397+
/**
398+
* @param EmailAddress[] $values
399+
* @return $this
400+
*/
401+
public function setToRecipients($values){
402+
foreach ($values as $val){
403+
if($val instanceof EmailAddress)
404+
$this->getToRecipients()->addChild(new Recipient($val));
405+
}
406+
return $this;
407+
}
408+
397409
/**
398410
* @return EntityCollection
399411
*/

src/Planner/Planner.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerAppliedCategories.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerAssignedToTaskBoardTaskFormat.php

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:12:31+00:00
4+
* Modified: 2020-05-26T22:12:31+00:00
55
*/
66
namespace Office365\Planner;
77

@@ -18,9 +18,6 @@ class PlannerAssignedToTaskBoardTaskFormat extends Entity
1818
*/
1919
public function getUnassignedOrderHint()
2020
{
21-
if (!$this->isPropertyAvailable("UnassignedOrderHint")) {
22-
return null;
23-
}
2421
return $this->getProperty("UnassignedOrderHint");
2522
}
2623
/**
@@ -37,10 +34,7 @@ public function setUnassignedOrderHint($value)
3734
*/
3835
public function getOrderHintsByAssignee()
3936
{
40-
if (!$this->isPropertyAvailable("OrderHintsByAssignee")) {
41-
return null;
42-
}
43-
return $this->getProperty("OrderHintsByAssignee");
37+
return $this->getProperty("OrderHintsByAssignee", new PlannerOrderHintsByAssignee());
4438
}
4539
/**
4640
* Dictionary of hints used to order tasks on the AssignedTo view of the Task Board. The key of each entry is one of the users the task is assigned to and the value is the order hint. The format of each value is defined as outlined [here](planner-order-hint-format.md).

src/Planner/PlannerAssignment.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerAssignments.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerBucket.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerBucketTaskBoardTaskFormat.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerCategoryDescriptions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerChecklistItem.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerChecklistItems.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerExternalReference.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerExternalReferences.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerGroup.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-24T22:10:26+00:00
4+
* Modified: 2020-05-24T22:10:26+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerOrderHintsByAssignee.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerPlan.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:12:31+00:00
4+
* Modified: 2020-05-26T22:12:31+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerPlanDetails.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:12:31+00:00
4+
* Modified: 2020-05-26T22:12:31+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerProgressTaskBoardTaskFormat.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerTask.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:12:31+00:00
4+
* Modified: 2020-05-26T22:12:31+00:00
55
*/
66
namespace Office365\Planner;
77

8+
use Office365\Common\IdentitySet;
89
use Office365\Entity;
9-
use Office365\IdentitySet;
1010
use Office365\Runtime\ResourcePath;
1111
/**
1212
* The **plannerTask** resource represents a Planner task in Office 365. A Planner task is contained in a [plan](plannerplan.md) and can be assigned to a [bucket](plannerbucket.md) in a plan. Each task object has a [details](plannertaskdetails.md) object which can contain more information about the task. See [overview](planner-overview.md) for more information regarding relationships between group, plan and task.

src/Planner/PlannerTaskDetails.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:12:31+00:00
4+
* Modified: 2020-05-26T22:12:31+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerUser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-24T22:08:35+00:00
4+
* Modified: 2020-05-24T22:08:35+00:00
55
*/
66
namespace Office365\Planner;
77

src/Planner/PlannerUserIds.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Generated by phpSPO model generator 2020-05-26T22:10:14+00:00
4+
* Modified: 2020-05-26T22:10:14+00:00
55
*/
66
namespace Office365\Planner;
77

src/Runtime/Auth/ClientCredential.php

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
class ClientCredential
88
{
99

10+
/**
11+
* @param string $clientId
12+
* @param string $clientSecret
13+
*/
1014
public function __construct($clientId, $clientSecret)
1115
{
1216
$this->ClientId = $clientId;

0 commit comments

Comments
 (0)