?
Solved

Import Adresses from mail Contacts

Posted on 2007-10-09
10
Medium Priority
?
197 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#
0
Comment
Question by:PeterSvendsen
  • 5
  • 5
10 Comments
 
LVL 21

Expert Comment

by:surajguptha
ID: 20042389
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...
0
 

Author Comment

by:PeterSvendsen
ID: 20046735
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.
0
 
LVL 21

Expert Comment

by:surajguptha
ID: 20049356
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.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:PeterSvendsen
ID: 20054829
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)
0
 
LVL 21

Expert Comment

by:surajguptha
ID: 20055652
What did you mean by mail contacts? Can you explain in a little details please?
0
 

Author Comment

by:PeterSvendsen
ID: 20056019
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
}
0
 

Author Comment

by:PeterSvendsen
ID: 20057802
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.
0
 
LVL 21

Accepted Solution

by:
surajguptha earned 1500 total points
ID: 20058149
Well my guess is that if you use the outlook object and try to read the contacts it should work for most outlook versions. But lets assume that it was lotus, you might have to code it seperately for that because it is a different object model. I am 90% positive that there is no ONE way of getting info from all email clients.
0
 

Author Comment

by:PeterSvendsen
ID: 20108760
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.
0
 
LVL 21

Expert Comment

by:surajguptha
ID: 20108840
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.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Integration Management Part 2
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question