Solved

Address Book

Posted on 2001-07-18
14
287 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

839 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