@@ -291,6 +291,50 @@ def test_discover_email_config(td: TestData):
291291 smtp = list (filter (lambda x : x .protocol_type == 'SMTP' , configs .value ))[0 ] #type: models.EmailAccountConfig
292292 assert smtp .host == 'smtp.gmail.com'
293293
294+ @pytest .mark .pipeline
295+ def test_create_mapi (td : TestData ):
296+ name = str (uuid .uuid4 ())+ '.msg'
297+ td .email .create_mapi (requests .CreateMapiRequest (
298+ name ,
299+ models .HierarchicalObjectRequest (
300+ models .HierarchicalObject ('IPM.Contact' , internal_properties = [
301+ models .PrimitiveObject ("Tag:'PidTagMessageClass':0x1A:String" , None , "IPM.Contact" ),
302+ models .PrimitiveObject ("Tag:'PidTagSubject':0x37:String" ),
303+ models .PrimitiveObject ("Tag:'PidTagSubjectPrefix':0x3D:String" ),
304+ models .PrimitiveObject ("Tag:'PidTagMessageFlags':0xE07:Integer32" , value = "8" ),
305+ models .PrimitiveObject ("Tag:'PidTagNormalizedSubject':0xE1D:String" ),
306+ models .PrimitiveObject ("Tag:'PidTagBody':0x1000:String" ),
307+ models .PrimitiveObject ("Tag:'PidTagStoreSupportMask':0x340D:Integer32" , value = "265849" ),
308+ models .PrimitiveObject ("Tag:'PidTagSurname':0x3A11:String" , value = "Surname" ),
309+ models .PrimitiveObject ("Tag:'PidTagOtherTelephoneNumber':0x3A1F:String" , value = "+79123456789" ),
310+ models .PrimitiveObject ("Tag:'':0x6662:Integer32" , value = "0" ),
311+ models .PrimitiveObject (
312+ "Lid:'PidLidAddressBookProviderArrayType':0x8029:Integer32:00062004-0000-0000-c000-000000000046" ,
313+ value = "1" )]),
314+ models .StorageFolderLocation (td .storage , td .folder ))))
315+ assert td .email .object_exists (requests .ObjectExistsRequest (td .folder + '/' + name , td .storage )).exists
316+
317+ @pytest .mark .pipeline
318+ def test_mapi_add_attachment (td : TestData ):
319+ name = _create_calendar (td )
320+ attachment = _create_calendar (td )
321+ td .email .add_mapi_attachment (requests .AddMapiAttachmentRequest (
322+ name , attachment , models .AddAttachmentRequest (
323+ models .StorageFolderLocation (td .storage , td .folder ),
324+ models .StorageFolderLocation (td .storage , td .folder ))))
325+ attachment_downloaded = td .email .get_calendar_attachment (requests .GetCalendarAttachmentRequest (
326+ name , attachment , td .folder , td .storage ))
327+ with open (attachment_downloaded , 'r' ) as f :
328+ filedata = f .read ()
329+ assert 'Aspose Ltd' in filedata
330+
331+ @pytest .mark .pipeline
332+ def test_mapi_get_properties (td : TestData ):
333+ name = _create_calendar (td )
334+ properties = td .email .get_mapi_properties (requests .GetMapiPropertiesRequest (
335+ name , td .folder , td .storage ))
336+ assert 'IPM.Schedule' in properties .hierarchical_object .name
337+
294338def _create_calendar (td , start_date_param = None ):
295339 name = str (uuid .uuid4 ())+ '.ics'
296340 start_date = (
0 commit comments