Contact photo and attachment unable to set

Hi

Please can you send me sample code to add a contact image (i.e. Contact photo) . & Send me code to add attachment in contact. I am not able to add birthday.

Thank you

Hi Maruti,


I am afraid to inform that at present, MapiContact doesn’t support adding Contact photo and attachments. Even if you will try to load such a contact from disc and save to PST, the photo as well as attachment will be lost. I have requested development team to provide their assistance in this regard and will write back here as soon as there is some information available.

PS: In order to set the birthday, you can use: mapiContact.Events.Birthday = DateTime.Now;


Hi Maruti,


Thanks for being patient.

I would like to share with you that this issue has already been logged in our issue tracking system with issue id: NETWORKNET-34078. As soon as this enhancement is added, we’ll update you here via this thread. We appreciate your patience until then.

The issues you have found earlier (filed as NETWORKNET-34078) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi
please can you give me status of bug no : NETWORKNET-34078.


I am waiting still now.

Hi Maruti,

Thank you for writing to us.

We have already provided the support for adding photo data and attachments to a MapiContact. Please have a look at the following code samples for your reference and let us know your feedback.

1. Adding Image data to a MapiContact

static void AddPhotoToMapiContact()
{
    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);
}

//Save the Contact in MSG format
contact.Save("MapiContact.msg", ContactSaveFormat.Msg);

//Save the Contact in VCF format
contact.Save("MapiContact.vcf", ContactSaveFormat.VCard);
}

2. Adding an Attachment to MapiContact

static void AddAttachmentToMapiContact()
{
    MapiMessage mapi = MapiMessage.FromFile("MapiContact.msg");
    MapiContact contact2 = (MapiContact)mapi.ToMapiMessageItem();

    using (FileStream fs = new FileStream("Log.txt", FileMode.Open))
    {
        byte[] buffer = new byte[fs.Length];
        fs.Read(buffer, 0, buffer.Length);
        contact2.Attachments.Add("Log.txt", buffer);
    }

    contact2.Save("MapiContactWithAtt.msg", ContactSaveFormat.Msg);
}