reading the Outlook addressbook

Posted by Admin on 13-Nov-2007 04:13

Hi all,

I have a small problem reading the Outlook addressbook.

I have to develope a program in which i read all the address in the addressbook and put them into a temp-table. I had to made a similair program to read all the contactpersons in outlook and that works good, but atm i'm stuck at the point where i actually have to read into the addressbook.

DEFINE VARIABLE hOutlook AS COM-HANDLE NO-UNDO.

DEFINE VARIABLE hNameSpace AS COM-HANDLE NO-UNDO.

define variable colFolders as com-handle no-undo.

CREATE 'Outlook.Application' hOutlook.

if valid-handle(hOutlook)

then do:

assign hNameSpace = hOutlook:GetNameSpace("MAPI":U)

colFolders = hNameSpace:AddressLists.

end.

RELEASE OBJECT hNameSpace NO-ERROR.

RELEASE OBJECT hOutlook NO-ERROR.

This is the code i'm trying to use to access the addressbook, accourding to the outlook object model it should give me "access to the root of the transport provider's address book hierarchy for the current session."

put when i try to run the code i get a message saying AddressLists = an unknown name.

Anyone who got an idea of how I could access the addressbook?

All Replies

Posted by kevin_saunders on 14-Nov-2007 03:23

Read this PEG API message from Jared, which should sort you out..

http://www.peg.com/lists/api/history/200707/msg00066.html

Posted by Admin on 21-Nov-2007 11:30

Woot one of my emails Made it in there haha

This thread is closed