使用 MAPI w/ C++,如何打开其他用户的收件箱?

发布于 2024-07-11 02:02:18 字数 685 浏览 11 评论 0原文

我希望编写一个自动监视脚本,以编程方式从另一个用户的 Exchange 2003 收件箱中检索信息。 我有可用的 C++ 代码来登录 MAPI 并连接到我自己的收件箱。 我还可以使用“控制面板”->“邮件”小程序将其他用户的邮箱配置到我的个人资料中,并且我的代码可以通过这种方式进行访问。 不过,这是在安装了 Outlook 的桌面上完成的,它提供了更丰富的邮件配置文件编辑器。

由于它将在服务器上运行,因此我不想安装 Outlook。 相反,我可以安装 MAPI 客户端。 然后,我创建一个简单的 MAPI 应用程序,该应用程序使用带有 MAPI_LOGON_UI 标志的 MAPILogonEx() 弹出邮件配置文件向导。 但是,基本 MAPI 客户端不具备配置其他用户邮箱的功能。 作为要求,我只能作为监视应用程序的服务帐户运行此脚本,因此我无法告诉它作为我想要的邮箱的帐户运行。

是否仍然可以使用基本 MAPI 客户端连接到其他用户的邮箱(假设已授予权限)? 或者是否必须安装 Outlook 才能使用此功能?

I'm looking to write an automated monitor script to programmatically retrieve information from another user's Exchange 2003 inbox. I have working C++ code to log into MAPI and connect to my own inbox. I can also use the Control Panel->Mail applet to configure another user's mailbox into my profile, and my code can access that way. However, this was done on my desktop with Outlook installed, which provides a richer mail profile editor.

Since this will run on a server, I'd prefer not to install Outlook at all. Instead, I can install the MAPI client. I then create a simple MAPI app that pops up the mail profile wizard using MAPILogonEx() with the MAPI_LOGON_UI flag. However, the basic MAPI client doesn't have the features to configure another user's mailbox. As a requirement, I can only run this script as the service account of the monitoring application, so I cannot tell it to run as the account whose mailbox I want.

Is it still possible to connect to another user's mailbox (assuming permissions are already granted) using the basic MAPI client? Or is it absolutely necessary to install Outlook for this functionality?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

旧夏天 2024-07-18 02:02:18

我强烈建议使用 Microsoft Exchange MAPI 客户端(如您所链接)。 它被设计为比这些库的 Outlook 版本更加强大。 您应该发现 Outlook 和 Exchange Server 之间的 API 在扩展 MAPI 方面没有什么不同。

您将需要使用扩展 MAPI(如 Cain TS Random 所描述)来打开其他邮件存储,当然您的应用程序需要以在 Exchange 服务器上具有适当权限的 Windows 用户身份登录。

I would strongly recommend using the Microsoft Exchange MAPI Client (as you have linked). It is engineered to be far more robust than the Outlook version of these libraries. You should find the API no different between Outlook and Exchange Server with respect to Extended MAPI.

You will need to use Extended MAPI (as described by Cain T S Random) to open other mail stores, and of course your application will need to be logged in as the Windows user with appropriate permissions on the Exchange server.

遗心遗梦遗幸福 2024-07-18 02:02:18

我明白了...我不知道如何明确地做到这一点; 这通常是使用错误标志调用 CreateStoreEntryID 的副作用。 您想要做的可能是:

  1. 从默认消息存储中获取 IID_IExchangeManageStore
  2. 调用 CreateStoreEntryID
  3. 然后通过条目 ID 打开该存储

    LPEXCHANGEMANAGESTORE mapiObject = NULL; 
    
      store->QueryInterface( IID_IExchangeManageStore, (LPVOID *) &mapiObject); 
    
      mapiObject->CreateStoreEntryID( 服务器, 邮箱, OPENSTORE_TAKE_OWNERSHIP |  
          OPENSTORE_USE_ADMIN_PRIVILEGE、&len、&buffer); 
    
      //根据条目id调用OpenEntry 
      

如果需要更详细的示例,请在 MFC MAPI 项目的源代码中搜索 CreateStoreEntryID。 如果您有其他问题,获得解答的最佳位置是 microsoft.public.win32.programmer.messaging 新闻组。

I see... I'm not sure how to do that explicitly; that's usually a side effect of calling CreateStoreEntryID with the wrong flags. What's you're looking to do is probably:

  1. Get an IID_IExchangeManageStore from your default message store
  2. Call CreateStoreEntryID
  3. Then open that store by the entry ID

    LPEXCHANGEMANAGESTORE mapiObject = NULL;
    
    store->QueryInterface( IID_IExchangeManageStore, (LPVOID *) &mapiObject);
    
    mapiObject->CreateStoreEntryID( server, mailbox, OPENSTORE_TAKE_OWNERSHIP | 
        OPENSTORE_USE_ADMIN_PRIVILEGE, &len, &buffer);
    
    //Call OpenEntry on the entry id
    

If you want a more detailed example, search the source of the MFC MAPI project for CreateStoreEntryID. If you have other questions, the best place to get them answered is the microsoft.public.win32.programmer.messaging newsgroup.

南风起 2024-07-18 02:02:18

您研究过ConfigureMsgService 吗? 我相信这适用于 Exchange MAPI,或者您是说您尝试过但它不起作用?

Have you looked into ConfigureMsgService? I believe that works with Exchange MAPI, or are you saying you tried that and it didn't work?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文