PRB: MAPI_E_NOT_FOUND Retrieving Global Profile Section Properties
ID: Q236455
|
The information in this article applies to:
-
Microsoft Windows versions 95, 98
-
Microsoft Outlook 98
-
Extended Messaging Application Programming Interface (MAPI), version 1.0
SYMPTOMS
When you access Global Profile Section properties using extended MAPI on a Windows 95 or Windows 98 computer with Microsoft Outlook 98 installed, you may get the following error:
MAPI_E_NOT_FOUND
CAUSE
The profile name used contains a space (for example "Default User").
RESOLUTION
The possible workarounds are:
Modify profile name to remove the space.
Call MAPILogonEx to logon to the profile first.
Install Microsoft Outlook 2000 to update the MAPI dlls.
MORE INFORMATIONSteps to Reproduce Behavior
- Create a profile named "Default User".
- Run the following code.
#include <mapix.h>
#include <mapidefs.h>
#include <mapiguid.h>
#include <edk.h>
#include <edkmdb.h>
HRESULT GetServerName();
void main()
{
GetServerName();
}
HRESULT GetServerName()
{
HRESULT hRes = S_OK;
LPPROFADMIN pAdminProfiles = NULL;
LPSERVICEADMIN pSvcAdmin = NULL;
LPPROFSECT pGlobalProfSect = NULL;
LPSPropValue pProps = NULL;
char szServerName[256];
// initialize the MAPI subsystem,
if ( FAILED ( hRes = MAPIInitialize ( NULL ) ) )
return hRes;
// Get a Profile admin object
if ( FAILED ( hRes = MAPIAdminProfiles ( 0L, &pAdminProfiles ) ) )
goto CleanUp;
// Get a ServiceAdmin object
if ( FAILED ( hRes = pAdminProfiles -> AdminServices (
"Default User",
NULL,
0L,
0L,
&pSvcAdmin ) ) )
goto CleanUp;
// Get the Global Profile Section
if ( FAILED ( hRes = pSvcAdmin -> OpenProfileSection (
(LPMAPIUID)pbGlobalProfileSectionGuid,
NULL,
0L,
&pGlobalProfSect ) ) )
goto CleanUp;
// Call HrGetOneProp to get PR_PROFILE_HOME_SERVER
if ( FAILED ( hRes = HrGetOneProp ( pGlobalProfSect,
PR_PROFILE_HOME_SERVER,
&pProps ) ) )
goto CleanUp;
strcpy ( szServerName, "PR_PROFILE_HOME_SERVER == " );
strcat ( szServerName, pProps -> Value.lpszA );
// Replace window handle param with your application's window handle
MessageBox ( 0L, szServerName, "Exchange Server Name", MB_OK );
CleanUp:
// Free all memory allocated by any MAPI calls
if ( NULL != pAdminProfiles )
pAdminProfiles -> Release ();
if ( NULL != pSvcAdmin )
pSvcAdmin -> Release ( );
if ( NULL != pGlobalProfSect )
pGlobalProfSect -> Release ( );
if ( NULL != pProps )
MAPIFreeBuffer ( &pProps );
pSvcAdmin = NULL;
pGlobalProfSect = NULL;
pProps = NULL;
pAdminProfiles = NULL;
// Return the HRESULT to the calling function
return hRes;
}
You will see that HrGetOneProp on PR_PROFILE_HOME_SERVER returns the following error message:
-2147221233 (MAPI_E_NOT_FOUND)
NOTE: This code sample needs to be compiled using the "Ignore all default libraries" option on the Link tab of the Project Settings dialog box. The following libraries must also be used:
- edkguid.lib
- msvcrt.lib
- edkutils.lib
- edkdebug.lib
- edkmapi.lib
- mapi32.lib
- user32.lib
- kernel32.lib
REFERENCES
For additional information about how to open the Global Profile
Section and retrieve properties that exist in this section, please see the following article in the Microsoft Knowledge Base:
Q188482 HOWTO: Open the Global Profile Section
Additional query words:
Profile Space
Keywords : kbMAPI kbMsg kbOutlook98 kbVC kbWinOS95 kbWinOS98 kbMAPI100 kbGrpMsg kbDSupport
Version : WINDOWS:1.0,95,98
Platform : WINDOWS
Issue type : kbprb
|