Hi again,
We need to create a contact on Exchange Server but wnat to have its image also in it. Is there any code sample you can share?
Hi again,
We need to create a contact on Exchange Server but wnat to have its image also in it. Is there any code sample you can share?
Hi Aaron,
You can use the following sample code to create an Exchange Contact with Photo information in it. Please try it at your end and share your feedback with us.
Code:
MapiContact contact = new MapiContact();
contact.NameInfo = new MapiContactNamePropertySet("Bertha", "A.", "Buell");
contact.ProfessionalInfo = new MapiContactProfessionalPropertySet("Awthentikz", "Social work assistant");
contact.PersonalInfo.PersonalHomePage = "B2BTies.com";
contact.PhysicalAddresses.WorkAddress.Address = "Im Astenfeld 59 8580 EDELSCHROTT";
contact.ElectronicAddresses.Email1 = new MapiContactElectronicAddress("Experwas", "SMTP", "BerthaABuell@armyspy.com");
contact.Telephones = new MapiContactTelephonePropertySet("06605045265");
//Add a photo
using (FileStream fs = File.OpenRead("Desert.jpg"))
{
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, buffer.Length);
contact.Photo = new MapiContactPhoto(buffer,
MapiContactPhotoImageFormat.Jpeg);
}
IEWSClient client = GetAsposeEWSClient();
client.CreateContact(contact);