public static void ContactCreate(String[] argv) { try { Outlook.ApplicationClass outlookApplicationClass = new Outlook.ApplicationClass(); Outlook.NameSpace outlookNameSpace = outlookApplicationClass.GetNamespace("MAPI"); outlookNameSpace.Logon(OutlookProfile, OutlookPassword, OutlookShowDialog, OutlookNewSession); foreach (string contactName in argv) { Outlook.ContactItem outlookContact = (Outlook.ContactItem)outlookApplicationClass.CreateItem(OlItemType.olContactItem); outlookContact.FirstName = contactName; outlookContact.LastName = contactName; outlookContact.MailingAddressStreet = "123 Some St."; outlookContact.MailingAddressCity = "Anytown"; outlookContact.MailingAddressState = "CA"; outlookContact.MailingAddressPostalCode = "12345"; outlookContact.MailingAddressCountry = "USA"; outlookContact.CompanyName = "Acme Inc."; outlookContact.Email1Address = "*****@*****.**"; outlookContact.Email1AddressType = "SMTP"; outlookContact.Save(); } } catch (System.Exception ex) { System.Console.WriteLine("Exception Message: {0}", ex.Message); } }
public _com_OutlookContactItem(Outlook.ContactItem item) : base(item) { Guard.NullArgument(item, "item"); _item = item; }