如何找到Outlook .pst文件的完整路径?

5

有没有一种通过API调用或注册表项编程方式来查找当前用户Outlook .pst文件位置的方法?

2个回答

5
使用Outlook Redemption,您可以通过RDOSession.Stores属性访问的RDOStores集合,在VBA中迭代消息存储。我正在研究在原装VBA中实现类似功能的可能性...
编辑:
显然,PST的路径已编码在StoreId字符串中。谷歌找到了这个
Sub PstFiles()
  Dim f As MAPIFolder

  For Each f In Session.Folders
    Debug.Print f.StoreID
    Debug.Print GetPathFromStoreID(f.StoreID)
  Next f
End Sub

Public Function GetPathFromStoreID(sStoreID As String) As String
  On Error Resume Next
  Dim i As Long
  Dim lPos As Long
  Dim sRes As String

  For i = 1 To Len(sStoreID) Step 2
    sRes = sRes & Chr("&h" & Mid$(sStoreID, i, 2))
  Next

  sRes = Replace(sRes, Chr(0), vbNullString)
  lPos = InStr(sRes, ":\")

  If lPos Then
    GetPathFromStoreID = Right$(sRes, (Len(sRes)) - (lPos - 2))
  End If
End Function

刚刚测试了一下,按照设计工作正常。


1
Redemption 的便利之处在于它明确地公开了 RDOPstStore.PstPath 属性 (http://www.dimastr.com/redemption/rdostore.htm#RDOPstStore),而无需破解存储区入口 ID。 - Dmitry Streblechenko

0

路径应该在以下位置之一:

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook]

也许这可以帮助一点。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接