Outlook 找到pst位置的注册表项?
对于outlook 2010,我们在以下位置设置了outlook配置文件:-Outlook 找到pst位置的注册表项?,outlook,registry,pst,Outlook,Registry,Pst,对于outlook 2010,我们在以下位置设置了outlook配置文件:-HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows消息子系统\\profiles outlook 2013的类似位置为:-HKCU\\Software\\Microsoft\\Office\\15.0\\outlook\\Profiles 在我的程序中,我首先查找2013年的配置文件,得到一个例外,我查找2010年的配置文件位置 但如果前景被降级到
HKCU\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows消息子系统\\profiles
outlook 2013的类似位置为:-HKCU\\Software\\Microsoft\\Office\\15.0\\outlook\\Profiles
在我的程序中,我首先查找2013年的配置文件,得到一个例外,我查找2010年的配置文件位置
但如果前景被降级到2010年,这将失败。因为outlook 2013的注册表项仍将位于同一位置
有什么建议吗。也许,如果我可以先安装正确版本的outlook,然后搜索正确的键,而不是使用try…except…块
主要是我想列出所有附加到Outlook的pst文件。注册表中有一个附加pst的记录,但似乎更多的是由Outlook搜索索引的pst文件的记录,因此,我不确定清除索引缓存是否会在某一点上从注册表中删除条目,但我使用了以下两个位置: Office2007 HKCU:\software\Microsoft\Office\12.0\Outlook\Catalog Office 2013 HKCU:\software\Microsoft\Office\15.0\Outlook\Catalog 还请注意,这似乎是附加档案的历史记录,而不是活动附加档案的列表。为了获取主动连接的归档文件,我找到的唯一方法是使用COM对象(Outlook.Application),但这不是很好,因为初始化COM对象当然会启动Outlook,因此如果在后台提取信息,可能会让最终用户不安 这里说的是一个小的PowerShell脚本,它既可以转储附加的归档文件,也可以在注册表中搜索附加归档文件的历史记录,并将结果放在桌面上
'****************************Currently attached archives' | Out-File
$Env:UserProfile\Desktop\ArchiveHistory.txt -append
#NOTE: This launches Outlook if it is not already running.
$Outlook = New-Object -Comobject Outlook.Application
$Namespace = $Outlook.GetNamespace('MAPI')
$Mailboxes = $Namespace.Stores | where {$_.ExchangeStoreType -eq 1} | Select-Object DisplayName
$AttachedArchives = $Namespace.Stores | where {$_.ExchangeStoreType -eq 3} | Select-Object DisplayName,FilePath
$MailBoxes | Out-File -FilePath $Env:UserProfile\Desktop\OutlookMailboxes.txt
$AttachedArchives | Out-File -FilePath $Env:UserProfile\Desktop\OutlookAttachedArchives.txt
'****************************Archive History for Office 2007' | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append
get-item HKCU:\software\Microsoft\Office\12.0\Outlook\Catalog | select -expandProperty property | where {$_ -match '.pst$'} | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt
'****************************Archive History for Office 2010' | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append
get-item HKCU:\software\Microsoft\Office\14.0\Outlook\Catalog | select -expandProperty property | where {$_ -match '.pst$'} | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt
'****************************Archive History for Office 2013' | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append
get-item HKCU:\software\Microsoft\Office\15.0\Outlook\Search\Catalog | select -expandProperty property | where {$_ -match '.pst$'} | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append
'****************************Archive History for Office 2016' | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append
get-item HKCU:\software\Microsoft\Office\16.0\Outlook\Search\Catalog | select -expandProperty property | where {$_ -match '.pst$'} | Out-File $Env:UserProfile\Desktop\ArchiveHistory.txt -append
PST文件位置存储在注册表的配置文件部分中。设计用于访问和操作配置文件数据的官方支持的API是接口(如果单击IProfAdmin按钮,您可以在中使用它)。PST路径存储在
PR\PST\u path
属性中。扩展的MAPI只能从C++或Delphi访问。
您可以使用(它附带了的可分发版本);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文件现在是否存储在用户配置文件“我的文档/Outlook文件”中???你不应该从那里开始吗?@BigChris。。。我说的是获取所有附加的pst文件。您是对的,pst文件将在您提到的位置,但其他附加文件在自定义位置如何?啊,您的问题没有提到您正在查看当前为特定用户加载的pst。您可以更新您的问题吗?您可以尝试搜索Outlook的“默认”安装位置,以便查看存在哪个文件夹“Outlook.exe”。如果EXE的父文件夹是最新版本(15.0等),那么您可以将其与您拥有的注册表项进行交叉检查,并获得“最新”的配置文件。显然,如果您有两个Office版本(并非闻所未闻!)的安装,那么您将有两个Outlook.exe-这将是一个障碍。。。此外,Office的定制安装可能会将这种逻辑抛到脑后……为什么不在2010年和2013年的位置进行搜索呢?谢谢@riahc3。把它弄干净一点。