Global Address List Entry ID problem for IMailUser

S

Stuart Bray

Hi, I've got a problem I'm hoping someone can shed some light on.
We're fetching information about GAL users from a machine that does
*not* have Outlook installed. We use the Exchange System Manager
version of MAPI, since it has been recommended that Outlook not be
installed on server machines. The problem is that the Entry ID we
get from our server machine (with ESM MAPI) is not the same as the
EntryID we get from a machine with Outlook installed - it appears to
be much shorter, maybe because it's not cached? This ID cannot be
used to open the contact with IAddrBook::Details on any other machine
that has Outlook installed; it's returning MAPI_E_NOT_FOUND.

Anyone know a solution?

Here's how we're getting PR_ENTRYID on the machine with Exchange
System Manager installed:


SizedSPropTagArray(3, sptaAttributes) =
{
3,
{
PR_ENTRYID,
PR_RECORD_KEY,
PR_LAST_MODIFICATION_TIME
}
};

hr = m_pGAB->GetContentsTable(unicodeFlag, &lpContentTable);
if (HR_FAILED(hr))
{
return false;
}

hr = lpContentTable->SetColumns((LPSPropTagArray)&sptaAttributes, 0);
if (HR_FAILED(hr))
{
return false;
}

// Query 25 rows at a time
hr = lpContentTable->QueryRows(25, 0, &lpRows);
while(SUCCEEDED(hr))
{
for(ULONG index = 0; index < lpRows->cRows; index++)
{
// setup the folder var's
CString strItemEID = "";

if(!IsErrorProp(lpRows->aRow[index].lpProps[0]))
{
strItemEID = CMapiUtil::Bin2Hex(
lpRows->aRow[index].lpProps[0].Value.bin.cb,
lpRows->aRow[index].lpProps[0].Value.bin.lpb
);
LOG_DEBUG(L"EID: %s", strItemEID);
}

.... and here's how we try to open this item, on a machine that has
Outlook installed:

hr := m_session.OpenAddressBook(0, PGUID(nil)^, AB_NO_DIALOG,
addrBook);
if (hr <> S_OK) or (addrBook = nil) then
begin
DoCleanup;
FatalError('TUIOutlookManipulator/ViewItem - OpenAddressBook
failed', hr, m_session);
exit;
end;

item.SetEntryIdFromString(eid);
handle := Cardinal(Application.Handle);
addrBook.Details(handle,
nil,
nil,
item.m_eidLength,
item.m_eid,
nil,
nil,
nil,
DIALOG_MODAL);


Any suggestions would be greatly appreciated!
 
D

Dmitry Streblechenko

Firstly, win32.programmer.messaging is a better newsgroup for the Extended
MAPI questions.
Secondly, most likely you are getting a short term entry id (which can only
be used in the current MAPI session) - try to use the entry id retrieved
from IMAPTable to open the corresponding IMailUser usingg
IAddrBook::OpenEntry, then retrieve PR_ENTRYID from the IMailUser usin
HrGetOneProp or IMailUser::GetProps.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top