Free Support Forum - aspose.com

Importing vcard

Hi


I am trying to import vcard file which is stored on disk.
can you please give us the sample code.

Thanks
Amol
Hi

I am able to import vcard file but I need to again save vcard in .msg format on disk.
I was able to do the same thing for calendar.

Code for calendar:

Aspose.Email.Mail.Appointment appointment = Aspose.Email.Mail.
Appointment.Load(ICSPath);
Aspose.Email.Mail.MailMessage mailMsg = new Aspose.Email.Mail.MailMessage();
mailMsg.AddAlternateView(appointment.RequestApointment());
Aspose.Email.Outlook.MapiMessage mapiMsg = Aspose.Email.Outlook.MapiMessage.
FromMailMessage(mailMsg);
mapiMsg.Save(MSGPath);


it seems that we need to add alternate view of contact type
as that for calendar so we can get the mapi message and then we can save in msg format.
( mailMsg.AddAlternateView(appointment.RequestApointment());)


But not able to find out the view for contact and there is no class for contact in
Aspose.Email.Mail as that for appoinment

please help as I am stuck also provide sample code

Thanks
Amol Sonawane

Hi Amol,


Thanks for your inquiry. You can use the Load method of VCardContact to use a VCard file that is stored on the disk. Please have a look at the following sample code that loads a VCard from disc and let us know your feedback.

Sample Code:

var vcfTest = VCardContact.Load(“C://Jon.vcf”);

Hi Amol,


At present, we don’t support saving contact as MSG file and this feature is planned to be provided in the upcoming version of Aspose.Email for .NET 3.4.0. However, if you want to add MapiContact to PST by loading its data from VCard, you can use the following code sample for this purpose:

Sample Code:

MapiContact contact = MapiContact.FromVCard(“C://Jon.vcf”);<o:p></o:p>


Once the feature of saving MapiContact as MSG file is available, you’ll be able to load the VCard contact and save it by loading it in MapiContact.

<o:p></o:p>

hi

var vcfTest = VCardContact.Load("C://Jon.vcf");

can you please tell under which namespace I can find VcardContact class .

hi


I have imported vcard file in pst.

PersonalStorage m_ObjPersonalStorage = PersonalStorage.Create
(“test.pst”, FileFormatVersion.Unicode);


Aspose.Email.License lic = new Aspose.Email.License();
lic.SetLicense(licpath);


FolderInfo f_obj = m_ObjPersonalStorage.CreatePredefinedFolder(“contact”, StandardIpmFolder.Contacts);
MapiContact contact = MapiContact.FromVCard(vcfpath);
f_obj.AddMapiMessageItem(contact);




it get imported but the contact picture cannot be viewed in pst where as it is there in vcf
please give some solution
Thanks
Amol

Hi Amol,


This is a known issue that is already reported in our issue tracking system under issue id: NETWORKNET-34088 and has been fixed now. The upcoming version of Aspose.Email for .NET 3.4.0 will include this rectification. I’ve linked this thread with the logged ticket so that once the new version is available, you’ll be notified here automatically.

Hi


Thanks for quick response.

One more issue.

I have vcf which need to import to pst it gives exception

MapiContact contact = MapiContact.FromVCard(“test.vcf”);

Exception Message : {“header doesn’t correspond to vCard format”}


but it gets open when I opened it manually by double clicking it.

Thanks
Amol

Hi Amol,


Could you please provide us with the sample vcf file that gives raise to this issue? Also, if you could share the sample code with which such vcf contact has been created, we may analyze the issue in a better way and provide you further assistance.

Also, I would suggest you to please create a new thread for each issue you find. This helps us keep track of single issue per thread and provide assistance in a better way after it is logged.

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


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