I am exporting Outlook contacts to .csv file and took all Outlook contacts to
List<Outlook.ContactItem> contactItems
created a method called ConvertToCSV() to extract each property of particular contact.In this Method am adding each contact's properties to List as shown below code.
private void ConvertToCSV(List<Outlook.ContactItem> contactItems)
{
using (var file = File.CreateText(@"D:\ExportContacts1.CSV"))
{
file.WriteLine(ContactItemsListToCSV());
foreach (var arr in contactItems)
{
List<string> list = new List<string>();
list.Add(arr.Title);
list.Add(arr.FirstName);
list.Add(arr.MiddleName);
list.Add(arr.LastName);
list.Add(arr.BusinessAddress);
list.Add(arr.BusinessAddressStreet);
list.Add(arr.BusinessAddressCity);
list.Add(arr.BusinessAddressState);
list.Add(arr.BusinessAddressPostalCode);
list.Add(arr.BusinessAddressCountry);
file.WriteLine(list[0] + "," + list[1] + "," + list[2] + "," + list[3]);
}
when i see the .csv file created by outlook,in that i could find
<pre lang="xml">Business street, Business Street 2,Business Street 3
</pre>
for this Business Street which property i need to bind in the above code.In outlook contacts, i had seen like tree structure as
Business Address
Business Street
Business Street 2
Business Street 3
...and so on
attaching the image too.How can i access these properties from Outlook.Application so that i can get the same .csv file as the Outlook generates..any suggestion please