Article ID: 188295
Article Last Modified on 11/9/2005
HRESULT SetMaxRows()
{
// The following header files must be included
// for this code to compile correctly:
// #include <objbase.h>
// #include <mapix.h>
// #include <edk.h>
// #include <edkmdb.h>
// The following library files must be included
// for this code to compile and link correctly:
// kernel32.lib user32.lib MSVCRT.LIB mapi32.lib edkguid.lib
// edkutils.lib edkmapi.lib edkdebug.lib
HRESULT hRes = S_OK; // HRESULT error code returned by this method.
LPPROFADMIN pAdminProfiles = NULL; // Pointer to IProfAdmin object.
LPSERVICEADMIN pSvcAdmin = NULL; // Pointer to IServiceAdmin object.
LPPROFSECT pGlobalProfSect = NULL; // Pointer to IProfSect object.
SPropValue pProps[1]; // Pointer to PropValue PR_PROFILE_MAX_RESTRICT
// Zero out pProps.
ZeroMemory ( &pProps, sizeof ( SPropValue ) );
if ( FAILED ( hRes = MAPIInitialize ( NULL ) ) )
return hRes;
// Get a Profile admin object.
if ( FAILED ( MAPIAdminProfiles ( 0L, &pAdminProfiles ) ) )
goto CleanUp;
// Get a ServiceAdmin object.
if (FAILED(hRes = pAdminProfiles -> AdminServices("[profile name]",
// Profile name
NULL, // Profile password if needed
0L, // HWND of your application. Can be 0.
0L, // Flags
&pSvcAdmin // Pointer to IServiceAdmin
)))
goto CleanUp;
// Get the Global Profile Section by calling
// IServiceAdmin::OpenProfileSection
// Use pbGlobalProfileSectionGuid defined in Edkmdb.h as the entry ID
// to request. An IProfSect interface is returned by default.
if (FAILED(hRes = pSvcAdmin -> OpenProfileSection
((LPMAPIUID) pbGlobalProfileSectionGuid,
NULL, // NULL == IProfSect interface
MAPI_MODIFY, // Access to object
&pGlobalProfSect // Pointer to IProfSect
) ) )
goto CleanUp;
// Set pProps->ulProptag and Value.ul = PR_PROFILE_MAX_RESTRICT and
// 20000 respectively.
pProps->ulPropTag = PR_PROFILE_MAX_RESTRICT;
pProps->Value.ul = 20000;
// Call HrSetOneProp to get PR_PROFILE_MAX_RESTRICT.
if ( FAILED ( hRes = HrSetOneProp ( pGlobalProfSect,
pProps ) ) )
goto CleanUp;
CleanUp:
// Free and reset all memory allocated by any MAPI calls.
if ( NULL != pAdminProfiles )
pAdminProfiles -> Release ( );
if ( NULL != pSvcAdmin )
pSvcAdmin -> Release ( );
if ( NULL != pGlobalProfSect )
pGlobalProfSect -> Release ( );
pSvcAdmin = NULL;
pGlobalProfSect = NULL;
pAdminProfiles = NULL;
// Return the HRESULT to the calling function.
return hRes;
}
Additional query words: kbDSupport kbMsg kbEDK kbMAPI100 EDKAPI EMAPI MAPIIAB kbdse
Keywords: kbinfo kbapi kbmsg KB188295