Store.FilePath Property

GeoffG

New Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
QUESTIONS:

1. Why does the Store.FilePath property return a zero-length string when the store is used by an IMAP email address?

2. Is there a VBA property that will reveal the full hard-disc path for the PST file for a Gmail account?


MY SETUP:

I set up a Gmail email account in Microsoft Outlook 2010 on a Windows 10 computer:

This created a PST file on my hard disc.

The path to the PST file can be seen in two Outlook windows:

PATH TRUNCATED HERE:
File > Account Settings > Account Settings > Email Tab

FULL PATH HERE:
File > Account Settings > Account Settings > Data Files Tab > Settings


Very many thanks.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
It should get the path... but when i run this macro, it gets the exchange ost path but not gmail. I'll see if there is another way to get the path (will likely use Redemption) and find out if this is a bug.

Code:
Option Explicit

Private Sub GetDataFilePaths()
    Dim oStores As Outlook.Stores
    Dim oStore As Outlook.Store
  
    Set oStores = Application.Session.Stores

    For Each oStore In oStores

          Debug.Print oStore.DisplayName, oStore.FilePath

    Next

Set oStores = Nothing
Set oStore = Nothing
End Sub
 
Last edited:

GeoffG

New Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
Very many thanks for your reply.
I was using similar code.
Strange that the path is returned for POP accounts, but not IMAP accounts.
I hope you get somewhere with it and I'll look out for any further replies.
Thanks again.
Geoff
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Yeah, its weird... best guess it has something to do with the change from pst files to ost files for imap accounts. Still waiting to hear from my contacts on why its not working.

I tried using this macro with redemption and it does not return the imap account. If i use skIUnknown, it returns it.

Code:
Sub testpath()
Set rdo = CreateObject("Redemption.RDOSession")

rdo.Logon


For Each Store In rdo.Stores
  If (Store.StoreKind = skPstAnsi) Or (Store.StoreKind = skPstUnicode) Then
    Debug.Print Store.Name & " - " & Store.PstPath
  ElseIf (Store.StoreKind = skPrimaryExchangeMailbox) Then
    Debug.Print Store.Name & " - " & Store.OSTPath
  ElseIf (StoreKind = skIMAP4) Then
    
    Debug.Print Store.Name & " - " & "IMAP"

  End If
Next


End Sub
 

GeoffG

New Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
Many thanks for your reply.

I made a slight change to your code (copying your examples).

I found the Store.PSTPath property returned the path to the PST files storing data for the gmail accounts.

Sorry, I'm afraid I don't understand the significance of your comment that the macro does not work with Redemption - it did for me.

If the macro is not working for you (but is for me), then perhaps there are Outlook setup differences that I'm unaware of? Mine is a standalone computer running Microsoft Office 2010.

Anyway - thank you very much indeed.
I think my problem is solved.


Code:
Sub testpath()

    Dim RDO As Redemption.RDOSession
    Dim Store As Redemption.RDOStore

    Set RDO = CreateObject("Redemption.RDOSession")
    RDO.Logon

    For Each Store In RDO.Stores
      If (Store.StoreKind = skPstAnsi) Or (Store.StoreKind = skPstUnicode) Then
        Debug.Print Store.Name & " - " & Store.PstPath
      ElseIf (Store.StoreKind = skPrimaryExchangeMailbox) Then
        Debug.Print Store.Name & " - " & Store.OstPath
      ElseIf (Store.StoreKind = skIMAP4) Then
        Debug.Print Store.Name & " - " & "IMAP"
        
        ' Geoff added this:
        ' The following code line returns the hard-disc
        ' path to the PST file that stores gmail emails:
        Debug.Print Store.Name & " - " & Store.PstPath
        
      End If
    Next
    
    RDO.Logoff
    Set RDO = Nothing

End Sub
 
Top