I want to import contacts from address book of Outlook 2007 into my application.
I am using VB.NET 2008 SP1 .NET Framework 2
Because I am in .NET environment, I don't want to rely on COM objects or outlook objects which requires it to be installed on the system.
Is there a way I can read the contacts?
And at a glance, where are contacts stored by outlook?
ThanksWednesday, January 07, 2009 5:18 PM
Thank you for contacting Microsoft Innovate On Office Advisory Services.
Following are the details of your request:
Support Request Description:
- Do you want to know how to read the contacts from the Outlook 2007?
- You also want to know where the contacts stored by outlook are.
Please provide us the following information
· Which programming language do you want to use to achieve this functionality?
To know where outlook stores its contacts, refer to this third party link:
The links in this message may lead to third-party Web sites. Microsoft provides third-party resources to help you find customer service and/or technical support resources. Information at these sites may change without notice. Microsoft is not responsible for the content at any third-party Web sites and does not guarantee the accuracy of third-party information.Wednesday, January 07, 2009 8:11 PM
Hi and thanks
VB.NET 2008 SP1 .NET Framework 2.0
So that's my programming language, and yes I wanna know how to read contacts from Outlook 2007?
I want to import contacts from Outlook 2007 to my application.
Also, if possible it's a good idea if I will be able to export back contacts from my application to Outlook also!
Thank you very muchWednesday, January 07, 2009 9:48 PM
Thank you for your reply
Yes, of course I wanna import and export contacts in Outlook 2007 pro grammatically.
I want to do it by Visual Basic .NET 2008 SP1, .NET Framework 2.0 and please note that my project is not Visual Studio Tools for Office or VBA, my project is Standard Windows Application type and will be in pure VB.NET language, I also don't want to import/use COM object based components in my .NET application and also don't want to rely on Office components installed on the system...
Regards.Friday, January 09, 2009 12:12 AM
we apologize for the delayed reply.
so here we come up with few questions for you:
1) Do you have an exchange in the environment. If yes what's the Version?
2) When you say address book, are you talking about the contacts folder?
3) If you have an exchange in your enviornment and you are talking about the contacts, then we might be able to help.
Dhanashri.Monday, January 12, 2009 9:11 PM
I don't mind using COM. I am able to get the required information for the Default Contacts Folder, but cannot do so for an IMAP account such as MyName@Hotmail.Com; it appears as separate folder under Contacts. I am using the following code successfully for the Default Contacts Folder:
Public Overrides Function Load() As Boolean
Dim bResult As Boolean = False
Dim oOutlook As Outlook.Application = Nothing
Dim oNameSpace As Outlook.NameSpace
Dim oConFolder As Outlook.MAPIFolder = Nothing
Dim oConItems As Outlook.Items = Nothing
Dim oConItem As Outlook.ContactItem
oOutlook = New Outlook.Application
oNameSpace = oOutlook.GetNamespace("MAPI")
oNameSpace.Logon("", "", False, True)
oConFolder = oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
oConItems = oConFolder.Items
For Each oConItem In oConItems
Console.WriteLine("[" & oConItem.Email1DisplayName & "]: <" & oConItem.Email1Address & ">")
Console.WriteLine("[" & oConItem.Email2DisplayName & "]: <" & oConItem.Email2Address & ">")
Console.WriteLine("[" & oConItem.Email3DisplayName & "]: <" & oConItem.Email3Address & ">")
Catch ex As Exception
SSUtils.ShowErrorEx(ex, "Error in ContactsOutlook2007.Load()", True, True)
bResult = False
oConItem = Nothing
oConItems = Nothing
oConFolder = Nothing
oNameSpace = Nothing
oOutlook = Nothing
Load = bResult
Wednesday, February 18, 2009 7:58 AM