如何找出要提供給IExchangeManageStore :: GetMailboxTable的信息存儲的可分辨名稱?

[英]How to find out the distinguished name of the information store to feed to IExchangeManageStore::GetMailboxTable?


There is a Microsoft knowledge base article with sample code to open all mailboxes in a given information store. It works so far (requires a bit of copy & pasting on compilers newer than VC++ 6.0).

有一個Microsoft知識庫文章,其中包含用於打開給定信息存儲中的所有郵箱的示例代碼。它到目前為止工作(需要在比VC ++ 6.0更新的編譯器上進行一些復制和粘貼)。

At one point it calls IExchangeManageStore::GetMailboxTable with the distinguished name of the information store. For the Exchange 2007 Trial Virtual Server image it has to look like this:

有一次,它使用信息存儲的可分辨名稱調用IExchangeManageStore :: GetMailboxTable。對於Exchange 2007試用虛擬服務器映像,它必須如下所示:

"/o=Litware Inc/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=servers/cn=DC1".

Using OutlookSpy and clicking on IMsgStore and IExchangeManageStore reveals the desired string next to "Server DN:".

使用OutlookSpy並單擊IMsgStore和IExchangeManageStore會在“服務器DN:”旁邊顯示所需的字符串。

I want to avoid forcing the user to put this into a config file. So if OutlookSpy can do it, how can my application find out the distinguished name of the information store where the currently open mailbox is on?

我想避免強迫用戶將其放入配置文件中。因此,如果OutlookSpy可以這樣做,我的應用程序如何找到當前打開的郵箱所在的信息存儲的可分辨名稱?

3 个解决方案

#1


2  

Thinking there must be a pure MAPI solution, I believe I've figured out how OutlookSpy does it.


The following code snippet, inserted after

認為必須有一個純MAPI解決方案,我相信我已經弄清楚OutlookSpy是如何做到的。以下代碼片段,插入之后

printf("Created MAPI session\n");

in the example from KB194627, will show the Server DN.

在KB194627的示例中,將顯示服務器DN。

LPPROFSECT lpProfSect;
hr = lpSess->OpenProfileSection((LPMAPIUID)pbGlobalProfileSectionGuid, NULL, 0, &lpProfSect);
if(SUCCEEDED(hr))
{
    LPSPropValue lpPropValue;
    hr = HrGetOneProp(lpProfSect, PR_PROFILE_HOME_SERVER_DN, &lpPropValue);
    if(SUCCEEDED(hr))
    {
        printf("Server DN: %s\n", lpPropValue->Value.lpszA);
        MAPIFreeBuffer(lpPropValue);
    }
    lpProfSect->Release();
}



Update:
There is the function HrGetServerDN in the EDK 5.5 source code, it extracts the Server DN from a given session's PR_EMS_AB_HOME_MTA. I'll try it if the other way turns out to be unreliable.

更新:EDK 5.5源代碼中有函數HrGetServerDN,它從給定會話的PR_EMS_AB_HOME_MTA中提取服務器DN。如果另一種方式變得不可靠,我會試試。

#2


0  

It'll be in Active Directory, so you'd use ADSI/LDAP to look at CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com. Use Sysinternals' ADExplorer to have a dig around in there to find the value you're looking for.

它將在Active Directory中,因此您可以使用ADSI / LDAP查看CN = Microsoft Exchange,CN = Services,CN = Configuration,DC = example,DC = com。使用Sysinternals的ADExplorer在那里挖掘,找到你正在尋找的價值。

#3


0  

I'd download the source for MFCMapi and see how they do this.

我下載了MFCMapi的源代碼,看看他們是如何做到這一點的。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2008/09/17/73011e9b7f36404b08208c52ee73c6f5.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com