Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > HrFindExchangeGlobalAddressList fails after upgrade to Exchange 20
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 30th March 05:19
lesliemiller•ë%‰é¢–w«v+ºË¢{&‰Ê貇ír‰
External User
 
Posts: 1
Default HrFindExchangeGlobalAddressList fails after upgrade to Exchange 20



I am having a problem with a call to HrFindExchangeGlobalAddressList on
Windows 2003 servers running Exchange 2003. It runs successfully on Windows
2000 servers running Exchange 2000. The HrFindExchangeGlobalAddressList call
is failing with an "Unspecified error" (0x80004005). I have included the
sample code I am using:

#include <windows.h>
#include <mapidefs.h>
#include <mapitags.h>
#include <addrlkup.h>
#include <mapiutil.h>
#include <mapiguid.h>

HRESULT GetGALContents ()
{

ULONG cbeid = 0L;
LPENTRYID lpeid = NULL;
HRESULT hRes = S_OK;
ULONG ulObjType;

LPMAPICONTAINER lpGAL = NULL;
LPADRBOOK m_pAddrBook = NULL;
LPMAPISESSION pSession;

TCHAR szBuf[200];


if ( FAILED ( hRes = MAPIInitialize( NULL ) ) )
{
wsprintf(szBuf, "MAPIInitialize failed");
MessageBox( NULL, szBuf, "Error", MB_OK );
goto Quit;
}

if ( FAILED ( hRes = MAPILogonEx( 0, NULL, NULL,
MAPI_USE_DEFAULT | MAPI_NEW_SESSION | MAPI_EXTENDED | MAPI_NO_MAIL,
&pSession ) ) )
{
wsprintf(szBuf, "MAPILogonEx failed");
MessageBox( NULL, szBuf, "Error", MB_OK );
goto Quit;
}

if ( FAILED ( hRes = pSession->OpenAddressBook( 0L,
NULL,
AB_NO_DIALOG,
&m_pAddrBook ) ) )
{
wsprintf(szBuf, "OpenAddressBook failed");
MessageBox( NULL, szBuf, "Error", MB_OK );
goto Quit;
}

if ( FAILED ( hRes = HrFindExchangeGlobalAddressList( m_pAddrBook,
&cbeid,
&lpeid ) ) )
{
wsprintf(szBuf, "HrFindExchangeGlobalAddressList failed");
MessageBox( NULL, szBuf, "Error", MB_OK );
goto Quit;
}

if(FAILED(hRes = m_pAddrBook->OpenEntry((ULONG) cbeid,
(LPENTRYID) lpeid,
NULL,
MAPI_BEST_ACCESS,
&ulObjType,
(LPUNKNOWN *)&lpGAL)))
{
wsprintf(szBuf, "OpenEntry failed");
MessageBox( NULL, szBuf, "Error", MB_OK );
goto Quit;
}

if ( ulObjType != MAPI_ABCONT )
{
wsprintf(szBuf, "ObjType failed");
MessageBox( NULL, szBuf, "Error", MB_OK );
goto Quit;
}


return hRes;

Quit:
if ( NULL != lpGAL)
{
lpGAL -> Release ( );
lpGAL = NULL;
}


return hRes;
}

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
LPVOID lpMsgBuf;
HRESULT hRes = S_OK;

hRes = GetGALContents();

FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
hRes,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL );

MessageBox( NULL, (LPCTSTR)lpMsgBuf, "MAPI test", MB_OK );
LocalFree(lpMsgBuf);

return 0;
}
  Reply With Quote


  sponsored links


2 30th March 05:19
dan mitchell
External User
 
Posts: 1
Default HrFindExchangeGlobalAddressList fails after upgrade to Exchange 20



=?Utf-8?B?bGVzbGllbWlsbGVy?= <lesliemiller@discussions.microsoft.com>

Try getting the EDK source and tracing into that function to see what's
going on. Using the EDK as a whole is generally not your best bet, you're
better off using it bit by bit -- it's easier to link and you can avoid
the bugs in it.

See http://blogs.msdn.com/jasonjoh/archive/2004/08/01/204585.aspx for
more on why the EDK is bad, and a link to the source.

-- dan
  Reply With Quote
3 30th March 05:19
lesliemiller•ë%‰é¢–w«v+ºË¢{&‰Ê貇ír‰
External User
 
Posts: 1
Default HrFindExchangeGlobalAddressList fails after upgrade to Exchang


Thanks. What we've been able to figure out is that there is something about
default profiles that is causing it to fail. When we use a different profile
(changed MAPI_USE_DEFAULT to MAPI_LOGON_UI
  Reply With Quote
4 8th April 08:39
lesliemiller•ë%‰é¢–w«v+ºË¢{&‰Ê貇ír‰
External User
 
Posts: 1
Default HrFindExchangeGlobalAddressList fails after upgrade to Exchang


What we've been able to figure out is there is something about our default
profiles that is causing an error. When we use a different profile
(MAPI_LOGON_UI instead of MAPI_USE_DEFAULT in the call to MAPILogonEx) then
it can find the global address list.
  Reply With Quote
5 8th April 08:39
dan mitchell
External User
 
Posts: 1
Default HrFindExchangeGlobalAddressList fails after upgrade to Exchang


=?Utf-8?B?bGVzbGllbWlsbGVy?= <lesliemiller@discussions.microsoft.com>


So which line of the source is it going wrong on? What happens if you
create a profile at runtime (KB Q170225) and log into that one instead?

-- dan
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666