def __init__(self): dataDir = Settings.dataDir + 'ProgrammingOutlook/WorkingWithOutlookMessageFiles/CreateOutlookContact/' contact = MapiContact() # Set different properties of this Contact Item. # Set Name properties using MapiContactNamePropertySet name_prop_set = MapiContactNamePropertySet() name_prop_set.setSurname("Mellissa") name_prop_set.setGivenName("MacBeth") contact.setNameInfo(name_prop_set) # Set professional properties using MapiContactProfessionalPropertySet prof_prop_set = MapiContactProfessionalPropertySet() prof_prop_set.setTitle("Account Representative") prof_prop_set.setCompanyName("Contoso Ltd.") prof_prop_set.setOfficeLocation("36/2529") contact.setProfessionalInfo(prof_prop_set) # Telephones telephone = MapiContactTelephonePropertySet() telephone.setAssistantTelephoneNumber("(831) 758-7214") telephone.setBusiness2TelephoneNumber("(831) 759-2518") telephone.setBusinessTelephoneNumber("(831) 758-7285") telephone.setCallbackTelephoneNumber("(831) 758-7321 (After hours") telephone.setCarTelephoneNumber("(831) 758-7201") telephone.setCompanyMainTelephoneNumber("(831) 758-7368") telephone.setHome2TelephoneNumber("(831) 758-7256") telephone.setHomeTelephoneNumber("(831) 758-7257") telephone.setIsdnNumber("(831) 758-7381") telephone.setMobileTelephoneNumber("(831) 758-7368") telephone.setOtherTelephoneNumber("(831) 758-7201") telephone.setPagerTelephoneNumber("(831) 758-7368") telephone.setPrimaryTelephoneNumber("(831) 758-7334") telephone.setRadioTelephoneNumber("(831) 758-7234") telephone.setTelexNumber("(831) 758-7408") telephone.setTtyTddPhoneNumber("(800) 806-4474") contact.setTelephones(telephone) # Set Physical Address using MapiContactPhysicalAddress and MapiContactPhysicalAddressPropertySet phys_addrss = MapiContactPhysicalAddress() phys_addrss.setPostOfficeBox("144 Hitchcock Rd, Salinas, CA 93908") phys_addr_prop_set = MapiContactPhysicalAddressPropertySet() phys_addr_prop_set.setWorkAddress(phys_addrss) contact.setPhysicalAddresses(phys_addr_prop_set) # Set email information using MapiContactElectronicAddress and MapiContactElectronicAddressPropertySet email = MapiContactElectronicAddress() email.setAddressType("SMTP") email.setDisplayName("Melissa MacBeth ([email protected])") email.setEmailAddress("*****@*****.**") elec_addr_prop_set = MapiContactElectronicAddressPropertySet() elec_addr_prop_set.setEmail1(email) contact.setElectronicAddresses(elec_addr_prop_set) contactSaveFormat=ContactSaveFormat contact.save(dataDir + "OutlookContact.vcf", contactSaveFormat.VCard) print "Created outlook contact successfully."
def __init__(self): dataDir = Settings.dataDir + "ProgrammingOutlook/WorkingWithOutlookPersonalStorage/AddMapiContactToPST/" # Create an instance of MapiContact mapi_contact = MapiContact() # Contact #1 contact1 = MapiContact("Sebastian Wright", "*****@*****.**") # Contact #2 contact2 = MapiContact("Wichert Kroos", "*****@*****.**", "Grade A Investment") # Contact #3 contact3 = MapiContact( "Christoffer van de Meeberg", "*****@*****.**", "Krauses Sofa Factory", "046-630-4614" ) # Contact #4 contact4 = MapiContact() contact4.setNameInfo(MapiContactNamePropertySet("Margaret", "J.", "Tolle")) mapiContactGender = MapiContactGender contact4.getPersonalInfo().setGender(mapiContactGender.Female) contact4.setProfessionalInfo(MapiContactProfessionalPropertySet("Adaptaz", "Recording engineer")) contact4.getPhysicalAddresses().getWorkAddress().setAddress("4 Darwinia Loop EIGHTY MILE BEACH WA 6725") contact4.getElectronicAddresses().setEmail1( MapiContactElectronicAddress("Hisen1988", "SMTP", "*****@*****.**") ) contact4.getTelephones().setBusinessTelephoneNumber("(08)9080-1183") contact4.getTelephones().setMobileTelephoneNumber("(925)599-3355") # Contact #5 contact5 = MapiContact() contact5.setNameInfo(MapiContactNamePropertySet("Matthew", "R.", "Wilcox")) contact5.getPersonalInfo().setGender(mapiContactGender.Male) contact5.setProfessionalInfo(MapiContactProfessionalPropertySet("Briazz", "Psychiatric aide")) contact5.getPhysicalAddresses().getWorkAddress().setAddress("Horner Strasse 12 4421 SAASS") contact5.getTelephones().setBusinessTelephoneNumber("0650 675 73 30") contact5.getTelephones().setHomeTelephoneNumber("(661)387-5382") # Contact #6 contact6 = MapiContact() contact6.setNameInfo(MapiContactNamePropertySet("Bertha", "A.", "Buell")) contact6.setProfessionalInfo(MapiContactProfessionalPropertySet("Awthentikz", "Social work assistant")) contact6.getPersonalInfo().setPersonalHomePage("B2BTies.com") contact6.getPhysicalAddresses().getWorkAddress().setAddress("Im Astenfeld 59 8580 EDELSCHROTT") contact6.getElectronicAddresses().setEmail1( MapiContactElectronicAddress("Experwas", "SMTP", "*****@*****.**") ) contact6.setTelephones(MapiContactTelephonePropertySet("06605045265")) personalStorage = PersonalStorage() fileFormatVersion = FileFormatVersion standardIpmFolder = StandardIpmFolder pst = personalStorage.create(dataDir + "MapiContactToPST1.pst", fileFormatVersion.Unicode) contactFolder = pst.createPredefinedFolder("Contacts", standardIpmFolder.Contacts) contactFolder.addMapiMessageItem(contact1) contactFolder.addMapiMessageItem(contact2) contactFolder.addMapiMessageItem(contact3) contactFolder.addMapiMessageItem(contact4) contactFolder.addMapiMessageItem(contact5) contactFolder.addMapiMessageItem(contact6) print "Added MapiContacts Successfully."
def __init__(self): dataDir = Settings.dataDir + 'ProgrammingOutlook/WorkingWithOutlookMessageFiles/CreateOutlookContact/' contact = MapiContact() # Set different properties of this Contact Item. # Set Name properties using MapiContactNamePropertySet name_prop_set = MapiContactNamePropertySet() name_prop_set.setSurname("Mellissa") name_prop_set.setGivenName("MacBeth") contact.setNameInfo(name_prop_set) # Set professional properties using MapiContactProfessionalPropertySet prof_prop_set = MapiContactProfessionalPropertySet() prof_prop_set.setTitle("Account Representative") prof_prop_set.setCompanyName("Contoso Ltd.") prof_prop_set.setOfficeLocation("36/2529") contact.setProfessionalInfo(prof_prop_set) # Telephones telephone = MapiContactTelephonePropertySet() telephone.setAssistantTelephoneNumber("(831) 758-7214") telephone.setBusiness2TelephoneNumber("(831) 759-2518") telephone.setBusinessTelephoneNumber("(831) 758-7285") telephone.setCallbackTelephoneNumber("(831) 758-7321 (After hours") telephone.setCarTelephoneNumber("(831) 758-7201") telephone.setCompanyMainTelephoneNumber("(831) 758-7368") telephone.setHome2TelephoneNumber("(831) 758-7256") telephone.setHomeTelephoneNumber("(831) 758-7257") telephone.setIsdnNumber("(831) 758-7381") telephone.setMobileTelephoneNumber("(831) 758-7368") telephone.setOtherTelephoneNumber("(831) 758-7201") telephone.setPagerTelephoneNumber("(831) 758-7368") telephone.setPrimaryTelephoneNumber("(831) 758-7334") telephone.setRadioTelephoneNumber("(831) 758-7234") telephone.setTelexNumber("(831) 758-7408") telephone.setTtyTddPhoneNumber("(800) 806-4474") contact.setTelephones(telephone) # Set Physical Address using MapiContactPhysicalAddress and MapiContactPhysicalAddressPropertySet phys_addrss = MapiContactPhysicalAddress() phys_addrss.setPostOfficeBox("144 Hitchcock Rd, Salinas, CA 93908") phys_addr_prop_set = MapiContactPhysicalAddressPropertySet() phys_addr_prop_set.setWorkAddress(phys_addrss) contact.setPhysicalAddresses(phys_addr_prop_set) # Set email information using MapiContactElectronicAddress and MapiContactElectronicAddressPropertySet email = MapiContactElectronicAddress() email.setAddressType("SMTP") email.setDisplayName("Melissa MacBeth ([email protected])") email.setEmailAddress("*****@*****.**") elec_addr_prop_set = MapiContactElectronicAddressPropertySet() elec_addr_prop_set.setEmail1(email) contact.setElectronicAddresses(elec_addr_prop_set) contactSaveFormat = ContactSaveFormat contact.save(dataDir + "OutlookContact.vcf", contactSaveFormat.VCard) print "Created outlook contact successfully."
def __init__(self): dataDir = Settings.dataDir + 'ProgrammingOutlook/WorkingWithOutlookPersonalStorage/AddMapiContactToPST/' # Create an instance of MapiContact mapi_contact = MapiContact() # Contact #1 contact1 = MapiContact("Sebastian Wright", "*****@*****.**") # Contact #2 contact2 = MapiContact("Wichert Kroos", "*****@*****.**", "Grade A Investment") # Contact #3 contact3 = MapiContact("Christoffer van de Meeberg", "*****@*****.**", "Krauses Sofa Factory", "046-630-4614") # Contact #4 contact4 = MapiContact() contact4.setNameInfo( MapiContactNamePropertySet("Margaret", "J.", "Tolle")) mapiContactGender = MapiContactGender contact4.getPersonalInfo().setGender(mapiContactGender.Female) contact4.setProfessionalInfo( MapiContactProfessionalPropertySet("Adaptaz", "Recording engineer")) contact4.getPhysicalAddresses().getWorkAddress().setAddress( "4 Darwinia Loop EIGHTY MILE BEACH WA 6725") contact4.getElectronicAddresses().setEmail1( MapiContactElectronicAddress("Hisen1988", "SMTP", "*****@*****.**")) contact4.getTelephones().setBusinessTelephoneNumber("(08)9080-1183") contact4.getTelephones().setMobileTelephoneNumber("(925)599-3355") # Contact #5 contact5 = MapiContact() contact5.setNameInfo( MapiContactNamePropertySet("Matthew", "R.", "Wilcox")) contact5.getPersonalInfo().setGender(mapiContactGender.Male) contact5.setProfessionalInfo( MapiContactProfessionalPropertySet("Briazz", "Psychiatric aide")) contact5.getPhysicalAddresses().getWorkAddress().setAddress( "Horner Strasse 12 4421 SAASS") contact5.getTelephones().setBusinessTelephoneNumber("0650 675 73 30") contact5.getTelephones().setHomeTelephoneNumber("(661)387-5382") # Contact #6 contact6 = MapiContact() contact6.setNameInfo( MapiContactNamePropertySet("Bertha", "A.", "Buell")) contact6.setProfessionalInfo( MapiContactProfessionalPropertySet("Awthentikz", "Social work assistant")) contact6.getPersonalInfo().setPersonalHomePage("B2BTies.com") contact6.getPhysicalAddresses().getWorkAddress().setAddress( "Im Astenfeld 59 8580 EDELSCHROTT") contact6.getElectronicAddresses().setEmail1( MapiContactElectronicAddress("Experwas", "SMTP", "*****@*****.**")) contact6.setTelephones(MapiContactTelephonePropertySet("06605045265")) personalStorage = PersonalStorage() fileFormatVersion = FileFormatVersion standardIpmFolder = StandardIpmFolder pst = personalStorage.create(dataDir + "MapiContactToPST1.pst", fileFormatVersion.Unicode) contactFolder = pst.createPredefinedFolder("Contacts", standardIpmFolder.Contacts) contactFolder.addMapiMessageItem(contact1) contactFolder.addMapiMessageItem(contact2) contactFolder.addMapiMessageItem(contact3) contactFolder.addMapiMessageItem(contact4) contactFolder.addMapiMessageItem(contact5) contactFolder.addMapiMessageItem(contact6) print "Added MapiContacts Successfully."