【问题标题】:How to find full path of Outlook .pst file?如何找到 Outlook .pst 文件的完整路径?
【发布时间】:2010-09-16 18:53:58
【问题描述】:

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

【问题讨论】:

    标签: winapi vba outlook registry pst


    【解决方案1】:

    使用Outlook Redemption,您可以使用RDOStorescollection 迭代VBA 中的消息存储,可通过RDOSession.Stores 属性访问。

    我正在研究在开箱即用的 VBA 中做类似事情的可能性...

    编辑:

    显然,PST 的路径在 StoreId 字符串中编码。谷歌出现this

    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
    

    刚刚测试,按设计工作。

    【讨论】:

    【解决方案2】:

    路径应该在以下某处:

    [HKEY_CURRENT_USER\软件\微软\Windows NT\CurrentVersion\Windows 消息 子系统\配置文件\Outlook]

    也许这有点帮助。

    【讨论】:

      猜你喜欢
      • 2021-04-24
      • 1970-01-01
      • 1970-01-01
      • 2014-12-21
      • 2014-06-28
      • 1970-01-01
      • 2021-03-17
      • 2022-06-21
      • 2015-10-19
      相关资源
      最近更新 更多