 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Fritz Franz Guest
|
Posted: Mon Apr 16, 2007 9:53 pm Post subject: outlook 2003 ContactItem vs. AddressEntry |
|
|
Hello there!
We have an exchange server and office 2003. At the server there are various
addresslists, some of them have addresses and distribution lists mixed.
I try to get in contact with all that contacts. The goal is to be able to
update, delete and insert all of these entries (addresses and DL) according
client information in our database. With outlook I comunicate via OLE
(TLB_outlook.pas).
So: how to get access to the contacts? I found two ways: via addresslists
objects which delivers the structure of various addresslists stored on the
server. But finally I get an AddressEntry item which has not all the
information about a contact stored on the exchange-server. The other way is
via Folders where i get finally the ContactItem, which has all the fields I
expect. But here I miss the addresslist-structure which is fundamential for
us.
I tried to retrieve the ContactItem by ID of addressentry, but this
unfortunately does not work.
Anybody some ideas for me?
Thx in advance!
Fritz |
|
| Back to top |
|
 |
Dmitry Streblechenko Guest
|
Posted: Mon Apr 16, 2007 10:58 pm Post subject: Re: outlook 2003 ContactItem vs. AddressEntry |
|
|
In Outlook 2007, you can use AddressEnry.GetContact method.
In the previous versions of Outlook, you can parse the AB entry id to
extract the corresponding IPM.Contact message entry id
<plug>Redempion (URL below) exposes this through RDOAddressEntry.GetContact
method http://www.dimastr.com/redemption/rdo/RDOAddressEntry.htm) in all
versions of Outlook</plug>
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Fritz Franz" <fritzfranz24 (AT) hotmail (DOT) com> wrote in message
news:4623aa04$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Hello there!
We have an exchange server and office 2003. At the server there are
various addresslists, some of them have addresses and distribution lists
mixed.
I try to get in contact with all that contacts. The goal is to be able to
update, delete and insert all of these entries (addresses and DL)
according client information in our database. With outlook I comunicate
via OLE (TLB_outlook.pas).
So: how to get access to the contacts? I found two ways: via addresslists
objects which delivers the structure of various addresslists stored on the
server. But finally I get an AddressEntry item which has not all the
information about a contact stored on the exchange-server. The other way
is via Folders where i get finally the ContactItem, which has all the
fields I expect. But here I miss the addresslist-structure which is
fundamential for us.
I tried to retrieve the ContactItem by ID of addressentry, but this
unfortunately does not work.
Anybody some ideas for me?
Thx in advance!
Fritz
|
|
|
| Back to top |
|
 |
Fritz Franz Guest
|
Posted: Tue Apr 17, 2007 5:33 pm Post subject: Re: outlook 2003 ContactItem vs. AddressEntry |
|
|
Thanks for your reply, Dimitry!
| Quote: | In Outlook 2007, you can use AddressEnry.GetContact method.
In the previous versions of Outlook, you can parse the AB entry id to
extract the corresponding IPM.Contact message entry id
|
How to do that? I tried the following;
Outlook := CreateOleObject('Outlook.Application');
NameSpace := outlook.GetNameSpace('MAPI');
Folder := NameSpace.GetDefaultFolder(olFolderContacts);
myEntry := NameSpace.GetItemFromID(
NameSpace.AddressLists.Item[i].AddressEntries[j].ID, Folder.StoreID );
But then I get the errormessage "Operation not succeded" (or similar in
english, I have an italian Windows and Outlook).
If I try
myEntry := NameSpace.GetItemFromID(
NameSpace.AddressLists.Item[i].AddressEntries[j].MAPIOBJECT.EntryID,
Folder.StoreID );
then I geht the message: "interface not registered".
I have tried to do this too, but: after succesful registering the
Redemption.dll, I can't find its OLE-Server at ActiveX import of delphi.
Any further hints?
Thx in advance,
Fritz |
|
| Back to top |
|
 |
Dmitry Streblechenko Guest
|
Posted: Tue Apr 17, 2007 10:35 pm Post subject: Re: outlook 2003 ContactItem vs. AddressEntry |
|
|
1. You cannot use an AddressEntry.EntryID to call GetItemFromID. If you
compare the entry ids of the address entry (AddressEntry.EntryID)and the
corresponding IPM.Contact message (ContactItem.EntryID) you will see that
the ContactItem entry id embedded inside the AddressEntry entry id.
2. To use Redemption in Delphi, you need to either import its type library
first (Project | Import Type Library) if you want to use early binding, or
you can use late binding:
var Session, AdrEntry, Contact : OleVariant;
....
Session := CreateOleObject('Redemption.RDOSession');
Session.MAPIOBJECT := OutlookNamespace.MAPIOBJECT; //to make sure Redemption
uses the same session
AdrEntry := session.GetAddressEntryFromId(YourOutlookAddressEntry.EntryID);
Contact := AdrEntry.GetContact;
ShowMessage(Contact.FileAs);
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Fritz Franz" <fritzfranz24 (AT) hotmail (DOT) com> wrote in message
news:4624bea0$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Thanks for your reply, Dimitry!
In Outlook 2007, you can use AddressEnry.GetContact method.
In the previous versions of Outlook, you can parse the AB entry id to
extract the corresponding IPM.Contact message entry id
How to do that? I tried the following;
Outlook := CreateOleObject('Outlook.Application');
NameSpace := outlook.GetNameSpace('MAPI');
Folder := NameSpace.GetDefaultFolder(olFolderContacts);
myEntry := NameSpace.GetItemFromID(
NameSpace.AddressLists.Item[i].AddressEntries[j].ID, Folder.StoreID );
But then I get the errormessage "Operation not succeded" (or similar in
english, I have an italian Windows and Outlook).
If I try
myEntry := NameSpace.GetItemFromID(
NameSpace.AddressLists.Item[i].AddressEntries[j].MAPIOBJECT.EntryID,
Folder.StoreID );
then I geht the message: "interface not registered".
plug>Redempion (URL below) exposes this through
RDOAddressEntry.GetContact method
http://www.dimastr.com/redemption/rdo/RDOAddressEntry.htm) in all
versions of Outlook</plug
I have tried to do this too, but: after succesful registering the
Redemption.dll, I can't find its OLE-Server at ActiveX import of delphi.
Any further hints?
Thx in advance,
Fritz
|
|
|
| Back to top |
|
 |
Fritz Franz Guest
|
Posted: Wed Apr 18, 2007 5:59 am Post subject: Re: outlook 2003 ContactItem vs. AddressEntry |
|
|
One more time ciao Dmitry and thx for your answer!
| Quote: | 1. You cannot use an AddressEntry.EntryID to call GetItemFromID. If you
compare the entry ids of the address entry (AddressEntry.EntryID)and the
corresponding IPM.Contact message (ContactItem.EntryID) you will see that
the ContactItem entry id embedded inside the AddressEntry entry id.
|
I tried this because of your hint to "parse the AB entry ID...". But yes it
seemd also to me that this would not work. But what did you intend in your
hint?
| Quote: | 2. To use Redemption in Delphi, you need to either import its type library
first (Project | Import Type Library) if you want to use early binding,
|
I tried out this way and it woked for me. Many thanks.
Just one more question: your way works fine for all my address lists except
one: in my outlook there is a "global address list" ("elenco indirizzi
globale") which I can not find in any folder (even recursing). Also your
shown way to retrieve the contact item fails bringing an AV "read error from
address 00000000". This AddressList is returend by Namespace.AddressLists
but in Outlook it does not appear (in window of addresses - "rubrica") under
"All address lists" (the only english term in my outlook) but above. In the
properties dialog of this list it appears as "provider of the list of
Microsoft Exchange" ("provider della rubrica di Microsoft Exchange"),
"current server" ("server corrente") points to "C:\Documents and
Settings\<myusername>\Impostazioni locali\Dati
applicazioni\Microsoft\Outlook\" (<username> is a placeholder only in this
message you are reading) the "path in the hirarchy of directory" ("percorso
della gerarchia di directory") is "\Elenco indirizzi globale".
The other Addresslists are located in "public folders" ("cartelle
pubbliche") in a proper folder each.
So why can't the contacts of global adress list be accessed? Or: how to
access them?
Thx and regards,
Fritz |
|
| Back to top |
|
 |
Dmitry Streblechenko Guest
|
Posted: Wed Apr 18, 2007 8:12 am Post subject: Re: outlook 2003 ContactItem vs. AddressEntry |
|
|
GetContact *only* works for the OAB provider address entries which happen to
use messages in one of the contacts folders.
GAL does not use any messages in the mailbox (it is built on top of Active
Directory), hence GetContact will always return nil.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Fritz Franz" <fritzfranz24 (AT) hotmail (DOT) com> wrote in message
news:46256d80$1 (AT) newsgroups (DOT) borland.com...
| Quote: | One more time ciao Dmitry and thx for your answer!
1. You cannot use an AddressEntry.EntryID to call GetItemFromID. If you
compare the entry ids of the address entry (AddressEntry.EntryID)and the
corresponding IPM.Contact message (ContactItem.EntryID) you will see that
the ContactItem entry id embedded inside the AddressEntry entry id.
I tried this because of your hint to "parse the AB entry ID...". But yes
it seemd also to me that this would not work. But what did you intend in
your hint?
2. To use Redemption in Delphi, you need to either import its type
library first (Project | Import Type Library) if you want to use early
binding,
I tried out this way and it woked for me. Many thanks.
Just one more question: your way works fine for all my address lists
except one: in my outlook there is a "global address list" ("elenco
indirizzi globale") which I can not find in any folder (even recursing).
Also your shown way to retrieve the contact item fails bringing an AV
"read error from address 00000000". This AddressList is returend by
Namespace.AddressLists but in Outlook it does not appear (in window of
addresses - "rubrica") under "All address lists" (the only english term in
my outlook) but above. In the properties dialog of this list it appears as
"provider of the list of Microsoft Exchange" ("provider della rubrica di
Microsoft Exchange"), "current server" ("server corrente") points to
"C:\Documents and Settings\<myusername>\Impostazioni locali\Dati
applicazioni\Microsoft\Outlook\" (<username> is a placeholder only in this
message you are reading) the "path in the hirarchy of directory"
("percorso della gerarchia di directory") is "\Elenco indirizzi globale".
The other Addresslists are located in "public folders" ("cartelle
pubbliche") in a proper folder each.
So why can't the contacts of global adress list be accessed? Or: how to
access them?
Thx and regards,
Fritz
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|