【问题标题】:Inventory Remote Computers for PST's connected to Outlook?为连接到 Outlook 的 PST 清点远程计算机?
【发布时间】:2012-01-16 16:17:11
【问题描述】:

我这几天一直在寻找解决方案,我浏览了 Interop.Outlook 的 MSDN,我想我找到了我需要的东西,但似乎无法正确实施。

这是我根据我在 VBA 中看到的类似内容得出的代码。

class Program
{
    Stores allstores = new Stores();
    Store store;

    static void Main(string[] args)
    {
        foreach (var store in allstores)
        {
            MessageBox.Show(store.FilePath);
        }

    }
}

`

这基本上需要循环浏览计算机列表,并在其 Outlook(一些 2003 年,一些 2007 年)上运行此代码,以便在每个 Outlook 配置文件中清点所有连接的 PST。我确信这有更多的代码,但我根本无法让这部分工作。似乎缺乏有关清点 Outlook 数据文件的信息,其中大部分是从邮箱中读取电子邮件,而不是数据文件本身。

如果有人能对我所忽略的内容有所了解,将不胜感激。

编辑:

我现在实际上已经编写了一段代码,但是我遇到了兼容性问题。该程序按 Office 2010/2007 中的设计工作,但是在访问 2003 版本时会崩溃。我想我需要使用 Microsoft Office Object 11.0,但是我只列出了 Microsoft Office Object 12.0 - 有没有办法获得 11.0 参考?

【问题讨论】:

  • 需要检索PST的连接文件路径,说明一下。

标签: c# file outlook inventory


【解决方案1】:

This 可能有用,相当详尽的对象模型比较和开发指南。

【讨论】:

  • 谢谢,我现在一切正常。问题是“Store”在 2003 年不存在,所以我必须从 StoreID 读取并转换。
【解决方案2】:

没有理由实际登录到任何 Outlook 配置文件(可能需要身份验证提示)。所有信息都已在注册表的配置文件部分中。确切位置是特定于 Outlook 版本的,并且配置文件部分 guid 是随机生成的,因此文档化的配置文件管理 API(IProfAdmin 等)是可行的方法,但不幸的是它是扩展 MAPI,需要 C++ 或 Delphi。

如果使用 Redemption 是一个选项,它包括 ProfMan 库(可以任何语言访问),它可以让您从所有本地配置文件中提取所有 PST 文件位置,而无需实际登录。:

    'Print the path to all the PST files in all profiles
     PR_PST_PATH = &H6700001E
     set Profiles=CreateObject("ProfMan.Profiles")
     for i = 1 to Profiles.Count
       set Profile = Profiles.Item(i)
       set Services = Profile.Services
       Debug.Print "------ Profile: " & Profile.Name & " ------"
       for j = 1 to Services.Count
         set Service = Services.Item(j)
         If (Service.ServiceName = "MSPST MS") or (Service.ServiceName = "MSUPST MS") Then
            'there should be only one provider for this service
            'but we should really loop through all the providers
            Debug.Print Service.Providers.Item(1).ProfSect.Item(PR_PST_PATH)
         End If
       next
     next

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-25
    • 1970-01-01
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    • 2020-08-12
    相关资源
    最近更新 更多