By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,905 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,905 IT Pros & Developers. It's quick & easy.

Direct Access to Your Outlook Address Book

P: n/a


MetaPro Systems Inc. Visual Studio Dot Net Tips & Tricks #3 – Direct
Access to
Your Outlook Address Book.

Project Type: VS.NET Windows Application
Code Behind: Visual Basic

I have a project where I needed to access my Outlook Address book
directly. This is possible but very tricky. I got it to work and I
would like to share it with you. Thanks go to Jim Lennox of Scientific
Solutions Inc. for helping me work this out. I would also like to site
the book "Developing Applications using Outlook 2000, CDO, Exchange and
Visual Basic" by Piemonte and Jamison as
a good source for this subject.

I have created a simple project to illustrate this principle. The
project reads the outlook address book and write name, company and email
to a text file. You can download this project from our web site at
http://www.metaprosystems.com/NetTipsTricks.htm
Here are the key portions of the code.

Dim moNS As Outlook.NameSpace
Dim mcContacts As Outlook.MAPIFolder
Dim moItems As Outlook.Items
Dim moCt As Outlook.ContactItem

moNS = mobjOutlook.GetNamespace("mapi")
mcContacts = _

moNS.GetDefaultFolder(Outlook.OlDefaultFolders.olF olderContacts)
' set to the contact folder
moItems = mcContacts.Items

moItems = moItems.Restrict("[MessageClass] = 'IPM.Contact'")
' filter to select only contact items

moItems.Sort("[EMail1Address]", False) ' sort by email address
Bob Avallone
Copyright 2003.

Comments and questions are welcome. Please forward this entire message
To friends and colleagues. To subscribe or unsubscribe to Dot Net Tips &
Tricks, send an e-mail to ti**@metaprosystems.com or call MetaPro
Systems Inc. at (781) 860-7345.

MetaPro Systems Inc. offers the following services:

* Custom Business Software running under Windows
* Web Sites using ASP.NET
* VS.NET Mentoring
* VS.NET Coaching

For more information about MetaPro’s services, visit
www.metaprosystems.com or
call (781)860-7345.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.