Skip to content

Commit e1699a0

Browse files
committed
merge main & fix conflicts
2 parents ff8b683 + f412178 commit e1699a0

36 files changed

+1256
-154
lines changed

.github/workflows/php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: composer install --prefer-dist --no-progress
3131

3232
- name: Run Pint
33-
run: ./vendor/bin/pint --test
33+
run: ./vendor/bin/pint
3434

3535
- name: Run test suite
3636
run: ./vendor/bin/pest --parallel

composer.json

Lines changed: 74 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,77 @@
11
{
2-
"name": "dcblogdev/laravel-microsoft-graph",
3-
"description": "A Laravel Microsoft Graph API (Office365) package",
4-
"license": "MIT",
5-
"authors": [
6-
{
7-
"name": "David Carr",
8-
"email": "dave@dcblog.dev",
9-
"homepage": "https://dcblog.dev"
2+
"name": "dcblogdev/laravel-microsoft-graph",
3+
"description": "A Laravel Microsoft Graph API (Office365) package",
4+
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "David Carr",
8+
"email": "dave@dcblog.dev",
9+
"homepage": "https://dcblog.dev"
10+
}
11+
],
12+
"homepage": "https://github.com/dcblogdev/laravel-microsoft-graph",
13+
"keywords": [
14+
"Laravel",
15+
"MsGraph",
16+
"Graph",
17+
"Microsoft Graph",
18+
"Office365",
19+
"Microsoft365"
20+
],
21+
"require": {
22+
"illuminate/support": "^10.0|^11.0|^12.0",
23+
"league/oauth2-client": "^2",
24+
"guzzlehttp/guzzle": "7.x",
25+
"ext-json": "*",
26+
"ext-fileinfo": "*",
27+
"ext-curl": "*",
28+
"shitware-ltd/flysystem-msgraph": "^1.0",
29+
"microsoft/microsoft-graph": "^1.110|^2.26"
30+
},
31+
"require-dev": {
32+
"orchestra/testbench": "v8.0|v9.0|^10.0",
33+
"pestphp/pest": "^v2.34|^3.7",
34+
"pestphp/pest-plugin-laravel": "v2.4|^3.1",
35+
"laravel/pint": "^1.13",
36+
"mockery/mockery": "^1.6",
37+
"pestphp/pest-plugin-type-coverage": "^2.8|^3.3"
38+
},
39+
"autoload": {
40+
"psr-4": {
41+
"Dcblogdev\\MsGraph\\": "src/",
42+
"Dcblogdev\\MsGraph\\Tests\\": "tests"
43+
}
44+
},
45+
"autoload-dev": {
46+
"classmap": [
47+
"tests/TestCase.php"
48+
]
49+
},
50+
"extra": {
51+
"laravel": {
52+
"providers": [
53+
"Dcblogdev\\MsGraph\\MsGraphServiceProvider"
54+
],
55+
"aliases": {
56+
"MsGraph": "Dcblogdev\\MsGraph\\Facades\\MsGraph",
57+
"MsGraphAdmin": "Dcblogdev\\MsGraph\\Facades\\MsGraphAdmin"
58+
}
59+
}
60+
},
61+
"config": {
62+
"allow-plugins": {
63+
"pestphp/pest-plugin": true
64+
}
65+
},
66+
"scripts": {
67+
"lint": "vendor/bin/pint",
68+
"test": "vendor/bin/pest --parallel",
69+
"type-coverage": "vendor/bin/pest --coverage",
70+
"test-coverage": "vendor/bin/pest --type-coverage",
71+
"check": [
72+
"@lint",
73+
"@test-coverage",
74+
"@type-coverage"
75+
]
1076
}
11-
],
12-
"homepage": "https://github.com/dcblogdev/laravel-microsoft-graph",
13-
"keywords": [
14-
"Laravel",
15-
"MsGraph",
16-
"Graph",
17-
"Microsoft Graph",
18-
"Office365",
19-
"Microsoft365"
20-
],
21-
"require": {
22-
"illuminate/support": "^10.0|^11.0",
23-
"league/oauth2-client": "^2",
24-
"guzzlehttp/guzzle": "7.x",
25-
"ext-json": "*",
26-
"ext-fileinfo": "*",
27-
"ext-curl": "*",
28-
"shitware-ltd/flysystem-msgraph": "^1.0",
29-
"microsoft/microsoft-graph": "^1.110"
30-
},
31-
"require-dev": {
32-
"orchestra/testbench": "v8.0|v9.0",
33-
"pestphp/pest": "^v2.34",
34-
"pestphp/pest-plugin-laravel": "v2.4",
35-
"laravel/pint": "^1.13",
36-
"mockery/mockery": "^1.6",
37-
"pestphp/pest-plugin-type-coverage": "^2.8"
38-
},
39-
"autoload": {
40-
"psr-4": {
41-
"Dcblogdev\\MsGraph\\": "src/",
42-
"Dcblogdev\\MsGraph\\Tests\\": "tests"
43-
}
44-
},
45-
"autoload-dev": {
46-
"classmap": [
47-
"tests/TestCase.php"
48-
]
49-
},
50-
"extra": {
51-
"laravel": {
52-
"providers": [
53-
"Dcblogdev\\MsGraph\\MsGraphServiceProvider"
54-
],
55-
"aliases": {
56-
"MsGraph": "Dcblogdev\\MsGraph\\Facades\\MsGraph",
57-
"MsGraphAdmin": "Dcblogdev\\MsGraph\\Facades\\MsGraphAdmin"
58-
}
59-
}
60-
},
61-
"config": {
62-
"allow-plugins": {
63-
"pestphp/pest-plugin": true
64-
}
65-
},
66-
"scripts": {
67-
"pest": "vendor/bin/pest --parallel",
68-
"pest-cov": "vendor/bin/pest --coverage",
69-
"pest-type": "vendor/bin/pest --type-coverage",
70-
"pint": "vendor/bin/pint"
71-
}
7277
}

docs/v3/msgraph/emails.md

Lines changed: 142 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ MsGraph::emails();
1414

1515
Return a list of emails
1616

17+
If no options are set emails are loaded from the inbox folder.
18+
1719
```php
18-
MsGraph::emails()->get();
20+
MsGraph::emails()->get($folderIdOrName = 'Inbox', $params = []);
1921
```
2022

21-
By default, only 10 emails are returned this can be changed by either using GET requests or pass an array of option to get()
23+
By default, only 25 emails are returned this can be changed by either using GET requests or pass an array of option to get()
2224

2325
Option 1: GET Request
2426

@@ -34,21 +36,21 @@ The default array that is used internally is below, you can override these optio
3436

3537
```php
3638
[
37-
"\$orderby" => "displayName",
38-
"\$top" => $top,
39-
"\$skip" => $skip,
40-
"\$count" => "true",
39+
'$orderby' => "displayName",
40+
'$top' => $top,
41+
'$skip' => $skip,
42+
'$count' => "true",
4143
]
4244
```
4345

4446
This would look like this:
4547

4648
```php
47-
MsGraph::emails()->get([
48-
"\$orderby" => "displayName",
49-
"\$top" => 15,
50-
"\$skip" => 0,
51-
"\$count" => "true",
49+
MsGraph::emails()->get('Inbox', [
50+
'$orderby' => "displayName",
51+
'$top' => 15,
52+
'$skip' => 0,
53+
'$count' => "true",
5254
]);
5355
```
5456

@@ -134,6 +136,46 @@ To view an email call **->find($id)** followed by the id of the email.
134136
MsGraph::emails()->find($id);
135137
```
136138

139+
> From version v4.0.6, mark email as read when viewing it.
140+
141+
```php
142+
MsGraph::emails()->find($id, bool $markAsRead = false);
143+
```
144+
145+
Retrieve the emails using singleValueExtendedProperties.
146+
147+
```php
148+
MsGraph::emails()->get([
149+
'\$filter' => 'singleValueExtendedProperties/Any(ep: ep/id eq \'String {00020329-0000-0000-C000-000000000046} Name CustomProperty\' and ep/value eq \'CustomValue\')'
150+
]);
151+
```
152+
153+
## Get Email Attachments
154+
155+
Get email attachments
156+
```php
157+
MsGraph::emails()->findAttachment($id);
158+
```
159+
160+
## Get Email Attachment
161+
162+
Get email attachment by its id
163+
```php
164+
MsGraph::emails()->findAttachment($id, $attachmentId);
165+
```
166+
167+
## Mark email as read
168+
169+
```php
170+
MsGraph::emails()->markAsRead($id);
171+
```
172+
173+
## Mark email as unread
174+
175+
```php
176+
MsGraph::emails()->markAsUnread($id);
177+
```
178+
137179
## Send Email
138180

139181
To send an email the format is different to normal calls. The format is to call multiple methods to set the email properties.
@@ -172,6 +214,22 @@ MsGraph::emails()
172214
->send()
173215
```
174216

217+
singleValueExtendedProperties() can be used to add custom properties to the email.
218+
219+
```php
220+
MsGraph::emails()
221+
->to(['email@domains.com'])
222+
->subject('the subject')
223+
->body('the content')
224+
->singleValueExtendedProperties([
225+
[
226+
"id" => "String {00020329-0000-0000-C000-000000000046} Name CustomProperty",
227+
"value" => "CustomValue"
228+
]
229+
])
230+
->send()
231+
```
232+
175233
## Forward Email
176234

177235
To forward to an email call **->forward()** and use **->comment()** instead of **->body()**.
@@ -206,6 +264,79 @@ To delete an email call **->delete($id)** followed by the id of the email.
206264
MsGraph::emails()->delete($id);
207265
```
208266

267+
> Added in version v4.0.6
268+
# Email Folders
269+
270+
## Get folders
271+
272+
By default, folders are not sorted, change to true to sort folders into a custom list specified in priorityOrder
273+
274+
This is the default order when none specified.
275+
276+
```php
277+
$priorityOrder = [
278+
'Inbox' => 1,
279+
'Archive' => 2,
280+
'Drafts' => 3,
281+
'Sent Items' => 4,
282+
'Deleted Items' => 5,
283+
'Conversation History' => 6,
284+
'Junk Email' => 7,
285+
];
286+
287+
MsGraph::emails()->folders()->get(array $params = [], bool $sort = false, array $priorityOrder = [])
288+
```
289+
290+
## Get folder
291+
292+
```php
293+
MsGraph::emails()->folders()->find($id)
294+
```
295+
296+
## Get folder by name
297+
298+
```php
299+
MsGraph::emails()->folders()->findByName($name)
300+
```
301+
302+
## Create folder
303+
304+
```php
305+
306+
$data = [
307+
'displayName' => 'Test Folder',
308+
'isHidden' => false
309+
];
310+
311+
MsGraph::emails()->folders()->store($data)
312+
```
313+
314+
## Update folder
315+
316+
```php
317+
318+
$data = [
319+
'displayName' => 'Test Folder',
320+
'isHidden' => false
321+
];
322+
323+
MsGraph::emails()->folders()->update($data, $id)
324+
```
325+
326+
## Copy folder
209327

328+
```php
329+
MsGraph::emails()->folders()->copy($sourceId, $destinationId)
330+
```
210331

332+
## Move folder
211333

334+
```php
335+
MsGraph::emails()->folders()->move($sourceId, $destinationId)
336+
```
337+
338+
## Delete folder
339+
340+
```php
341+
MsGraph::emails()->folders()->delete($id)
342+
```

docs/v3/msgraph/files.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Get files from a group:
1818
MsGraph::files()->getFiles($path = null, $type = "groups/$groupId");
1919
```
2020

21-
To work with emails first call **->files()** followed by a method.
21+
To work with files first call **->files()** followed by a method.
2222

2323
```php
2424
MsGraph::files();
@@ -86,8 +86,8 @@ MsGraph::files()->rename($name, $id);
8686

8787
## Upload file
8888

89-
passes the name and the uploadPath (where the file is on your server) and the path to where the file will be stored if no path is provided the root is used.
89+
Pass the name and the uploadPath (where the file is on your server) and the path to where the file will be stored. If no path is provided the root is used.
9090

9191
```php
9292
MsGraph::files()->upload($name, $uploadPath, $path = null);
93-
```
93+
```

0 commit comments

Comments
 (0)