Solved

Address Book

Posted on 2001-07-18
14
288 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 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

756 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