找到所有 .pst 文件
Locate all .pst files
问候
我在查找 .pst 文件时遇到问题。 **
任务
** 是查找计算机上的所有 .pst 文件并创建它们的列表。
我尝试使用注册表项:“HKCU\Software\Microsoft\Office\%OfficeVersion%\Outlook\Search\Catalog”。看起来它包含所有 .pst & .ost 文件的列表,但事实证明它也包含已删除(或移动)文件的条目并且它仅当您在 Outlook 中手动连接 .pst 时才会更新。因此,如果您在某种 "Archive" 中移动旧的 .pst,我的注册表将不会包含有关它的信息。
我知道浏览所有文件需要太多时间,所以我想避免这种情况。
此外,请记住,用户可能有很多邮箱和很多 .pst(其中一些甚至可能根本没有连接到 Outlook)。而且我不能使用救赎之类的东西。只是普通的 C#(可能是一些 C++ MAPI 库)
非常感谢。
PST 文件位置存储在注册表的配置文件部分。官方支持的 API 旨在访问和操作配置文件数据是 IProfAdmin interface (you can play with it in OutlookSpy (我是它的作者),如果您单击 IProfAdmin 按钮)。 PST 路径存储在 PR_PST_PATH
属性 中。扩展 MAPI 只能从 C++ 或 Delphi.
访问
配置文件数据存储在注册表中,因此理论上您可以从注册表中读取数据,但密钥名称是配置文件特定的并且是随机生成的(配置文件部分名称是一个 guid)。另请注意,注册表中的配置文件数据位置是特定于 Outlook 版本的。
可以使用ProfMan (it comes with the distributable version of Redemption); ProfMan 可用于任何语言。以下脚本 (VB) 从所有本地配置文件中检索 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
MsgBox Service.Providers.Item(1).ProfSect.Item(PR_PST_PATH)
End If
next
next
您还可以使用 Outlook 对象模型从 PST 存储中检索 PST 文件名(但这需要 Outlook 运行,并且您只能对当前使用的配置文件执行此操作)- 使用 Store.FilePath 属性:
set vApp = CreateObject("Outlook.Application")
for each vStore in vApp.Session.Stores
MsgBox vStore.DisplayName & " - " & vStore.FilePath
next
问候
我在查找 .pst 文件时遇到问题。 **
任务
** 是查找计算机上的所有 .pst 文件并创建它们的列表。
我尝试使用注册表项:“HKCU\Software\Microsoft\Office\%OfficeVersion%\Outlook\Search\Catalog”。看起来它包含所有 .pst & .ost 文件的列表,但事实证明它也包含已删除(或移动)文件的条目并且它仅当您在 Outlook 中手动连接 .pst 时才会更新。因此,如果您在某种 "Archive" 中移动旧的 .pst,我的注册表将不会包含有关它的信息。
我知道浏览所有文件需要太多时间,所以我想避免这种情况。
此外,请记住,用户可能有很多邮箱和很多 .pst(其中一些甚至可能根本没有连接到 Outlook)。而且我不能使用救赎之类的东西。只是普通的 C#(可能是一些 C++ MAPI 库)
非常感谢。
PST 文件位置存储在注册表的配置文件部分。官方支持的 API 旨在访问和操作配置文件数据是 IProfAdmin interface (you can play with it in OutlookSpy (我是它的作者),如果您单击 IProfAdmin 按钮)。 PST 路径存储在 PR_PST_PATH
属性 中。扩展 MAPI 只能从 C++ 或 Delphi.
配置文件数据存储在注册表中,因此理论上您可以从注册表中读取数据,但密钥名称是配置文件特定的并且是随机生成的(配置文件部分名称是一个 guid)。另请注意,注册表中的配置文件数据位置是特定于 Outlook 版本的。
可以使用ProfMan (it comes with the distributable version of Redemption); ProfMan 可用于任何语言。以下脚本 (VB) 从所有本地配置文件中检索 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
MsgBox Service.Providers.Item(1).ProfSect.Item(PR_PST_PATH)
End If
next
next
您还可以使用 Outlook 对象模型从 PST 存储中检索 PST 文件名(但这需要 Outlook 运行,并且您只能对当前使用的配置文件执行此操作)- 使用 Store.FilePath 属性:
set vApp = CreateObject("Outlook.Application")
for each vStore in vApp.Session.Stores
MsgBox vStore.DisplayName & " - " & vStore.FilePath
next