How to find the full path to the Outlook.pst file?

Is there a way to programmatically find the location of the current Outlook.pst file through an API call or registry entry?

+5
source share
2 answers

With Outlook Redemption, you can iterate through message stores in VBA using the collection RDOStoresavailable through the property RDOSession.Stores.

I am exploring the possibility of doing something similar in the finished VBA ...

EDIT:

Obviously, the path to the PST is encoded in the StoreId line. Google has included 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

Just tested, works as designed.

+5
source

The path should be somewhere under:

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

, .

0

All Articles