Solved

Address Book

Posted on 2001-07-18
14
284 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
  • 5
  • 3
  • 2
  • +1
14 Comments
 

Accepted Solution

by:
_ov earned 150 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 150 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Where can I find the FoxPro ODBC Download version 1.0 6 30
Windows Installer 4 69
Post a good COM tutorial 1 49
VS2015 Redefinition errors 4 23
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

932 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now