Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Address Book

Posted on 2001-07-18
14
Medium Priority
?
298 Views
Last Modified: 2013-12-03
Hy.
 I want to know how i can read the Address Book (how i can get all the Contacts and
all the groups).
 And, has the Address Book the same structure under 98 and NT/2000.
 Because, under 98 all the Contacts are shown to all the user(all the
identities in the Outlook) and are the same for Outlook Express and Outlook
2000. Under Win 2000 there are some groups(?) for every user(identitie) in
Express and the Contacts in Express are not shown in Outlook 2000.
(is this done with the help of Groups)??
 
 Please help.
0
Comment
Question by:yhihi9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
14 Comments
 

Accepted Solution

by:
_ov earned 600 total points
ID: 6293410
Here is the code I've used to do something like this. It can be buggy, unstable etc, but it shows the way to go.
btw, you need to edit the first lines of code for your system. And I've tested it only with Outlook 2000.

#pragma warning(disable:4146)
#import "c:\program files\Microsoft office\office\mso9.dll"
#import "c:\program files\common files\Microsoft shared\vba\vba6\vbe6ext.olb"
#import "c:\program files\Microsoft office\office\msoutl9.olb"
#pragma warning(default:4146)

#include <iostream>
#include <atlbase.h>

using namespace std;

void main(void) {
     ::CoInitialize(NULL);
     try {
          Outlook::_ApplicationPtr     app;
          Outlook::_NameSpacePtr          sess;
          Outlook::AddressListsPtr          als;
          Outlook::AddressListPtr          al;
          Outlook::AddressEntriesPtr     aes;
          Outlook::AddressEntryPtr     ae;
         
          app.GetActiveObject(L"Outlook.Application");
          if (app==NULL) app.CreateInstance(L"Outlook.Application");
          if (app==NULL) throw("Unable to find Outlook");
          sess = app->GetSession();
          als = sess->GetAddressLists();
          long x, m = als->GetCount();
          for(x=1; x<=m; x++) {
               _variant_t     v(x);
               al = als->Item(&v);
               aes = al->GetAddressEntries();
               long y, m2 = aes->GetCount();
               for(y=1; y<=m2; y++) {
                    _variant_t     v(y);
                    ae = aes->Item(&v);
                    _bstr_t nm = ae->GetName();
                    char *n = (char *)nm;
                    _bstr_t ad = ae->GetAddress();
                    char *a = (char *)ad;
                    cout << x << " " << y << " " << n << "(" << a << ")" << endl;
               }
          }
     } catch(const char *txt) {
          cout << txt << endl;
     }

     ::CoUninitialize();
}
0
 

Author Comment

by:yhihi9
ID: 6294937

 Thanks, but it's not quite what i'm looking for.
 That is Outlook 2000 Automation (i used it) but indeed it works only for O2000
not for Express(or let's say better i can'tmake it to work under Win2000
- i don't know how to extract all those Groups and the Contacts for every group)
 I am interested, maybe, in how to read the wab format and how to obtain the informations
i mentioned above.(and if there is any code i would like it in C++/VC++).

 Thanks.
0
 
LVL 32

Assisted Solution

by:jhance
jhance earned 600 total points
ID: 6295991
You want to use MAPI for this.  See:

http://codeguru.earthweb.com/internet/simple_mapi.shtml

for a example project that will help you get started.
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!

 
LVL 1

Expert Comment

by:hide_in
ID: 6296691
I have wrote a prog to synchronize the address book of Outlook98/2000 and Outlook express.
I used MAPI to access the Outlook98/2000 address book, and
used the API of WAB32.dll to access the Outlook express address book.

I do it well.
if you think I can help, please tell me.
0
 

Author Comment

by:yhihi9
ID: 6303369

 Yes i am interested , but does it works under 98 and NT/2000?
0
 

Author Comment

by:yhihi9
ID: 6309767

 Hello.
 Can anyone tell me where i can find the format of the WAB  file?
0
 
LVL 32

Expert Comment

by:jhance
ID: 6309789
Reading the WAB file is not the way to do this.  To REPEAT my comment which you conveniently IGNORED!


You want to use MAPI for this.  See:

http://codeguru.earthweb.com/internet/simple_mapi.shtml

for a example project that will help you get started.
0
 
LVL 1

Expert Comment

by:hide_in
ID: 6332686
Of course, It's can work under win9x/win2000/winnnt
0
 

Author Comment

by:yhihi9
ID: 6370895
Sorry i have benn away for a few days.
 Hide in (if you still read this message) i will be very happy if you could give me the code.
 For  jhance . Thank you for your help (and i can say that you help me many times) i tryed your solution but it does not work as i want and need.
0
 
LVL 1

Expert Comment

by:hide_in
ID: 6371668
hi, yhihi9
I'm here.if you need I can write a demo to you and give you the code.
0
 

Author Comment

by:yhihi9
ID: 6376040

 OK i wait for the demo
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 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