Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Exchange Server / Applications / March 2007

Tip: Looking for answers? Try searching our database.

how to resolve MAPI_E_BAD_CHARWIDTH problem in GetMsgStoresTable call.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shivaraj - 13 Mar 2007 12:01 GMT
Hi,
I was trying to get mailbox store information using
"GetMsgStoresTable" MAPI call.

hr = pSession->GetMsgStoresTable(MAPI_UNICODE, &pTable);

But its failing as MAPI_E_BAD_CHARWIDTH. In net I found that this is
something to do with UNICODE ( The MAPI_UNICODE flag was set and MAPI
does not support Unicode at present.) but not getting how to fix this
so that I can get these store information. If any one is having sample
code or hint on proceeding further on this please let me know.
Regards,
Shivaraj
Dave Goldman [MSFT] - 13 Mar 2007 20:08 GMT
Don't pass MAPI_UNICODE as this will cause it to fail. You can pass NULL. Here is a small example for you and you can fix the rest of it but you get the idea.

// Declare a NULL SRowSet structure, and populate it with property values from one of the message stores by using IMAPITable::QueryRows. The following code retrieves the first (default) message store:

if (SUCCEEDED(hr = pSession->GetMsgStoresTable(0, &pTable)))
{

   //Declare a NULL IMsgStore interface object, and open the message store by using IMAPISession::OpenMsgStore - making use of the     SRowSet structure:
   if (SUCCEEDED(hr = pTable->QueryRows(1, 0, &pSRowSet)))
   {    
        if(FAILED(hr = pSession->OpenMsgStore(0, pSRowSet->aRow[0].lpProps[0].Value.bin.cb,
              (ENTRYID *)pSRowSet->aRow[0].lpProps[0].Value.bin.lpb, NULL, 0, &pStore)))
       {
           print("OpenMsgStore");
           return hr;
       {

   }
   else
   {
       print("QueryRowserror");
       return hr;
   }

}
else
{
   print("GetMsgStoresTable error");
   return hr;
}

// If no longer needed, release the message stores table by calling IUnknown::Release on the table object, and free the memory allocated for the row set structure by calling FreeProws:
pTable->Release();
FreeProws(pSRowSet);

Signature

This posting is provided "AS IS" with no warranties, and confers no rights.

Dgoldman
http://blogs.msdn.com/dgoldman
Download OABInteg (http://gotdotnet.com/Community/UserSamples/Download.aspx?SampleGuid=A2338E73-F52
1-4071-9B1D-AAF49C346ACD
)

 Hi,
 I was trying to get mailbox store information using
 "GetMsgStoresTable" MAPI call.

 hr = pSession->GetMsgStoresTable(MAPI_UNICODE, &pTable);

 But its failing as MAPI_E_BAD_CHARWIDTH. In net I found that this is
 something to do with UNICODE ( The MAPI_UNICODE flag was set and MAPI
 does not support Unicode at present.) but not getting how to fix this
 so that I can get these store information. If any one is having sample
 code or hint on proceeding further on this please let me know.
 Regards,
 Shivaraj
shivaraj - 14 Mar 2007 10:08 GMT
On Mar 14, 12:08 am, "Dave Goldman [MSFT]" <dgold...@noreply.msft.com>
wrote:
> Don't pass MAPI_UNICODE as this will cause it to fail. You can pass NULL. Here is a small example for you and you can fix the rest of it but you get the idea.
>
[quoted text clipped - 51 lines]
>   Regards,
>   Shivaraj

Hi Dave,
Thanks a lot for your information and sample code. I was able to
resolve it using above said approach.
Now eventhough my code is workign fine, still i have got some more
doubts with respect to store in MAPI.

1. If I see system manager there is a clean hirarchy of organization -
> Administrative group -> Servers -> Storage Group -> Mailbox Store ->
MailBoxes.  Through MAPI using "HrOpenExchangePrivateStore" I was able
to retrieve all mailbox information within a server (from all mailbox
stores). But my understanding was, using "GetMsgStoresTable" and
"OpenMsgStore" we should be able to get Mailbox store names. ( to get
clean mapping of StorageGroup -> MailboxStore -> MailBox mapping ).
But if i get PR_DISPLAY_NAME of each row in "GetMsgStoresTable", its
is returning something like "Mailbox - Administrator" and "Public
Folders". Any idea/views/suggestions will be appriciated as I am not
clear about MAPI MailboxStore concept.

2. I have a parent and child domain setup. My exchange server resides
in child domain. If I run my code ( C++ code to get mailbox
information ) with Administrative privilages of child domain, i am
able to retrieve all info. But if i create a user and make it as
domain admin and try to run my code, its failing during
"HrOpenExchangePrivateStore" call. Any extra permissions are required
for this?

Please let me know your views.

Regards,
Shivaraj
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.