HOWTO: Retrieve the PR_PROVIDER_DISPLAY Property

Last reviewed: February 26, 1998
Article ID: Q181732
The information in this article applies to:
  • Extended Messaging Application Programming Interface (MAPI), version 1.0

SUMMARY

This article describes how to determine the message store provider name.

MORE INFORMATION

The following code sample illustrates how to retrieve the PR_PROVIDER_DISPLAY property of a given message store. This can be useful in determining the type of information store you are working with.

Here is the code:

   #include <windows.h>
   #include <mapiutil.h>
   // NOTE: You will need to include Mapi32.lib as an additional
   // library in the Link tab of the Project Settings dialog box.

   HRESULT MsgStoreType ( LPMAPISESSION pSession, LPSBinary pMsgStoreID )
   {
      HRESULT         hRes = S_OK;
      LPMAPITABLE     pTable = NULL;
      LPSRowSet       pRows = NULL;
      SRestriction    sRes;
      SPropValue      spvStoreID;

      SizedSPropTagArray ( 2, spta ) =
         { 2, PR_ENTRYID, PR_PROVIDER_DISPLAY };

      ZeroMemory ( &sRes, sizeof ( SRestriction ));

      spvStoreID.ulPropTag = PR_ENTRYID;
      spvStoreID.Value.bin.cb = pMsgStoreID -> cb;
      spvStoreID.Value.bin.lpb = pMsgStoreID -> lpb;

      // Open the message stores table.
      hRes = pSession -> GetMsgStoresTable ( 0l, &pTable ) ) );

      if ( FAILED ( hRes ) )
         goto Cleanup;

      sRes.rt = RES_PROPERTY;
      sRes.res.resProperty.relop = RELOP_EQ;
      sRes.res.resProperty.ulPropTag = PR_ENTRYID;
      sRes.res.resProperty.lpProp = &spvStoreID;

      // Find the row that matches the passed in message store ID.
      hRes = HrQueryAllRows ( pTable,
                            (LPSPropTagArray)&spta,
                            &sRes,
                            NULL,
                            0l,
                            &pRows ) ) )
         goto Cleanup;

      // PR_PROVIDER_DISPLAY is in pRows -> aRow -> lpProps[1].Value.lpszA
      MessageBox ( m_hWnd,
                  pRows -> aRow -> lpProps[1].Value.lpszA,
                  "Information Store",
                  MB_OK );

   Cleanup:

      if ( pTable )
      {
         pTable -> Release ( );
         pTable = NULL;
      }

      if ( pRows )
         FreeProws ( pRows );

      return hRes;
   }

Keywords          : kbcode EMAPI MAPIIMS
Version           : WINDOWS:1.0
Platform          : WINDOWS
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 26, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.