ID: Q194435
The information in this article applies to:
When opening a folder with HrMAPIOpenFolderEx(), you may receive the following error:
0x800b0001.
The cause of the error is an invalid folder path.
The following code demonstrates the problem. The first call to open a folder fails because the path to the folder is incorrect. The second call succeeds because the path has been corrected.
The following additional libraries are required to compile this code:
#include <edk.h>
LPMAPISESSION lpMapiSession = NULL;
LPMDB lpPrivStore = NULL;
LPMAPIFOLDER lpFolder = NULL;
LPMAPITABLE lpContentTable = NULL;
LPSRowSet lpRows = NULL;
ULONG rCount = 0, i = 0;
HRESULT hr;
MAPIINIT_0 MapiInit;
char lngName[100];
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR pszCmd,
int nCmdShow)
{
MapiInit.ulVersion = 0;
MapiInit.ulFlags = MAPI_NT_SERVICE;
hr = MAPIInitialize( &MapiInit);
if (!HR_SUCCEEDED(hr))
{
MessageBox(0L,"MAPIInitialize error","Error",MB_OK);
return -1;
}
hr = MAPILogonEx( 0, (LPTSTR)NULL, (LPTSTR)"",
MAPI_NEW_SESSION | MAPI_EXTENDED | MAPI_LOGON_UI,
&lpMapiSession);
if (!HR_SUCCEEDED(hr))
{
MessageBox(0L,"MAPILogonEx error","Error",MB_OK);
return -1;
}
hr = HrOpenExchangePrivateStore( lpMapiSession, &lpPrivStore);
if (!HR_SUCCEEDED(hr))
{
MessageBox(0L,"HrOpenExchangePrivateStore error","Error",MB_OK);
return -1;
}
hr = HrMAPIOpenFolderEx(lpPrivStore,'\\',"\\Inbox",&lpFolder);
if (!HR_SUCCEEDED(hr))
{
char szError[50];
sprintf(szError, "HrMAPIOpenFolderEx error %x",hr);
MessageBox(0L,szError,"Error",MB_OK);
}
hr = HrMAPIOpenFolderEx(lpPrivStore,'\\',
"Top of Information Store\\Inbox",&lpFolder);
if (!HR_SUCCEEDED(hr))
{
MessageBox(0L,"HrMAPIOpenFolderEx error","Error",MB_OK);
return -1;
}
else
MessageBox(0L,"HrMAPIOpenFolderEx Successful","Error",MB_OK);
if (lpMapiSession)
{
lpMapiSession->Logoff(0, 0, 0);
ULRELEASE(lpMapiSession);
}
MAPIUninitialize();
return 0 ;
}
Technology : kbMsg kbMAPI kbEDK
Version : WINDOWS:1.0,5.0,5.5
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: October 22, 1998