@@ -27,6 +27,8 @@ class Emails extends MsGraph
27
27
28
28
private array $ attachments = [];
29
29
30
+ private array $ singleValueExtendedProperties = [];
31
+
30
32
public function id (string $ id ): static
31
33
{
32
34
$ this ->id = $ id ;
@@ -83,6 +85,13 @@ public function attachments(array $attachments): static
83
85
return $ this ;
84
86
}
85
87
88
+ public function singleValueExtendedProperties (array $ singleValueExtendedProperties ): static
89
+ {
90
+ $ this ->singleValueExtendedProperties = $ singleValueExtendedProperties ;
91
+
92
+ return $ this ;
93
+ }
94
+
86
95
public function top (string $ top ): static
87
96
{
88
97
$ this ->top = $ top ;
@@ -246,6 +255,7 @@ protected function prepareEmail(): array
246
255
$ cc = $ this ->cc ;
247
256
$ bcc = $ this ->bcc ;
248
257
$ attachments = $ this ->attachments ;
258
+ $ singleValueExtendedProperties = $ this ->singleValueExtendedProperties ;
249
259
250
260
$ toArray = [];
251
261
foreach ($ to as $ email ) {
@@ -264,14 +274,30 @@ protected function prepareEmail(): array
264
274
265
275
$ attachmentArray = [];
266
276
foreach ($ attachments as $ file ) {
277
+ if (array_key_exists ('name ' , $ file ) && array_key_exists ('contentBytes ' , $ file )) {
278
+ $ attachmentArray [] = [
279
+ '@odata.type ' => '#microsoft.graph.fileAttachment ' ,
280
+ 'name ' => $ file ['name ' ],
281
+ 'contentBytes ' => $ file ['contentBytes ' ],
282
+ ];
283
+ } else {
267
284
$ path = pathinfo ($ file );
268
285
269
286
$ attachmentArray [] = [
270
- '@odata.type ' => '#microsoft.graph.fileAttachment ' ,
271
- 'name ' => $ path ['basename ' ],
272
- 'contentType ' => mime_content_type ($ file ),
273
- 'contentBytes ' => base64_encode (file_get_contents ($ file )),
287
+ '@odata.type ' => '#microsoft.graph.fileAttachment ' ,
288
+ 'name ' => $ path ['basename ' ],
289
+ 'contentType ' => mime_content_type ($ file ),
290
+ 'contentBytes ' => base64_encode (file_get_contents ($ file )),
274
291
];
292
+ }
293
+ }
294
+
295
+ $ singleValueExtendedPropertiesarray = [];
296
+ foreach ($ singleValueExtendedProperties as $ value ) {
297
+ $ singleValueExtendedPropertiesarray [] = [
298
+ 'id ' => $ value ['id ' ],
299
+ 'value ' => $ value ['value ' ],
300
+ ];
275
301
}
276
302
277
303
$ envelope = [];
0 commit comments