We help IT Professionals succeed at work.

Import Adresses from mail Contacts

PeterSvendsen
on
216 Views
Last Modified: 2013-11-07
I have a program where I want to import adresses from the users mail contacts.

Through my search I have found several examples on different ways to do this, but I lack the ability to judge which will work best for me.

I have been looking at MAPI, PIAs and Visual Studio Tool for Office.

I don't know what mail system the user has, so it need to be able to handle multible mail programs, versions and settings.

Visual Studio .NET 2005
Windows Application
C#
Comment
Watch Question

well if you already knew how to access these three systems. just add a config parameter in your config file which will determine which method to use. Just a suggestion...

Author

Commented:
Don't think I understand your answer. Might be my question that need clearification, so here goes...

I have a program where I want to import some adresses from the mail program to a datatable.
This program is used by alot of people with different settings so I have no idea what kind of mail system is used.
My generel C# knowledge is rather low and my knowledge on Office is even lower and the knowledge on the interacting between the two is what I am working on. I have been searching around for a while but havn't found anything that sound like what I am looking for.

Someone I know have a MAPI solution in VBA where he handle several mail systems in one blow. All the MAPI examples I have found are from some years back and I get the feeling that this is done in some other way now.

If I use PIA's I get a version for each Outlook version which has lead me to believe that I have to make a solution for each possible mail program. I hope I am wrong or there is an easier way.

VSTO seem to handle multible mail systems but it seem very overkill for the task and it seem like I have to add alot of restributable files for the installation if I go this way. Have to check up on what VS license I have as well. Not sure if VSTO is included.


As you might have noticed I do not have a clear view on how these things work and might have made some wrong conclusions on the way or very possibly missed something very basic.
well if you are just looking to get some information about mail contacts, you should try working on the active directory. You could query the active directory if you are sure all the mail systems have an active directory.

Author

Commented:
I don't know much about Active Directory, installations or the like but don't belive all the users has it.

The program run on the following platforms:
- Windows 2000
- Windows XP
- Windows Vista
- Mac Windows emulation (it is acceptable if it doen't work here)

The Windows installations cover:
- Simple home installations on private computers (no AD here to my knowledge)
- Thin clients on company network (probably with AD)
- Thick clients on company network (probably with AD)
What did you mean by mail contacts? Can you explain in a little details please?

Author

Commented:
In Outlook i have some Contacts. I want to import the information from the Address fields into a datagrid to make my program easier to use.

I have gotten it to work on my own computer with the following code but I was curious on which way would work best on a random computer.

Outlook._Application outlookObj = new Outlook.Application();
Outlook.MAPIFolder fldContacts = (Outlook.MAPIFolder)outlookObj.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
foreach (Outlook._ContactItem ci in fldContacts.Items)
{
  //Importing the Address information
}

Author

Commented:
I can add that the program is used on above 100 different computers witch probably has all kinds of mail solutions.
I am hoping to find a bit of code that will be able handle more than one mail system without having to code up to each of them. Hopefully without having to add too much redistributable files on the way.
I don't know what's possible but thats what I am looking for.
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thank you for for keeping focus. I understand that the question was a bit confusing.

Sadly my confusion on the subject is just about the same as when I started out, but you deserve the points for trying to help out.

I was trying to understand the differences between different ways to solve the mail contact interaction.
I have choosen one and hope it will work out for me.
In my opinion no one can support everything. Before you start off with this you will have to decide what e-mail clients you intend to support. That way you know exactly what you are looking for.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.