@@ -27,6 +27,8 @@ class Emails extends MsGraph
2727
2828 private array $ attachments = [];
2929
30+ private array $ singleValueExtendedProperties = [];
31+
3032 public function id (string $ id ): static
3133 {
3234 $ this ->id = $ id ;
@@ -83,6 +85,13 @@ public function attachments(array $attachments): static
8385 return $ this ;
8486 }
8587
88+ public function singleValueExtendedProperties (array $ singleValueExtendedProperties ): static
89+ {
90+ $ this ->singleValueExtendedProperties = $ singleValueExtendedProperties ;
91+
92+ return $ this ;
93+ }
94+
8695 public function top (string $ top ): static
8796 {
8897 $ this ->top = $ top ;
@@ -246,6 +255,7 @@ protected function prepareEmail(): array
246255 $ cc = $ this ->cc ;
247256 $ bcc = $ this ->bcc ;
248257 $ attachments = $ this ->attachments ;
258+ $ singleValueExtendedProperties = $ this ->singleValueExtendedProperties ;
249259
250260 $ toArray = [];
251261 foreach ($ to as $ email ) {
@@ -264,14 +274,30 @@ protected function prepareEmail(): array
264274
265275 $ attachmentArray = [];
266276 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 {
267284 $ path = pathinfo ($ file );
268285
269286 $ 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 )),
274291 ];
292+ }
293+ }
294+
295+ $ singleValueExtendedPropertiesarray = [];
296+ foreach ($ singleValueExtendedProperties as $ value ) {
297+ $ singleValueExtendedPropertiesarray [] = [
298+ 'id ' => $ value ['id ' ],
299+ 'value ' => $ value ['value ' ],
300+ ];
275301 }
276302
277303 $ envelope = [];
0 commit comments