How to get PST folder datetime?


Senior Member
Outlook version
Outlook 2013 32 bit
Email Account
Exchange Server
Operating system::    Windows 10
Outlook version:     Outlook 2016
Email type or host:    Exchage

The code I was able to geto from Diana's Slipstick Forum Print a list of your Outlook folders and slightly amended to be able to get datetime properpies of the Outlook folder. The output generated in the MS Outlook nested folder is fine, but it does not work with PST folders, the output generates error 'Run-time error '-2147221223 (8004010f0)': "The property" is unknown or cannot be found.

Here is the code

Public strFolders As String

Public Sub GetFolderNames()
Dim olApp As Outlook.Application
Dim olSession As Outlook.NameSpace
Dim olStartFolder As Outlook.MAPIFolder
Dim lCountOfFound As Long

lCountOfFound = 0

Set olApp = New Outlook.Application
Set olSession = olApp.GetNamespace("MAPI")

' Allow the user to pick the folder in which to start the search.
Set olStartFolder = olSession.PickFolder

' Check to make sure user didn't cancel PickFolder dialog.
If Not (olStartFolder Is Nothing) Then
' Start the search process.
ProcessFolder olStartFolder
End If

' Create a new mail message with the folder list inserted
Set ListFolders = Application.CreateItem(olMailItem)
ListFolders.Body = strFolders

' To create a text file you can open in Excel, use this
strPath = Environ("USERPROFILE") & "\Downloads\OutlookFolders\OutlookFolders.csv"
Debug.Print strPath
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Fileout = FSO.CreateTextFile(strPath, True, False)
Fileout.WriteLine strFolders

' clear the string so you can run it on another folder
strFolders = ""
End Sub

Sub ProcessFolder(CurrentFolder As Outlook.MAPIFolder)

Dim i As Long
Dim olNewFolder As Outlook.MAPIFolder
Dim olTempFolder As Outlook.MAPIFolder
Dim olTempFolderPath As String

Dim propertyAccessor As Outlook.propertyAccessor

' Loop through the items in the current folder.
For i = CurrentFolder.Folders.count To 1 Step -1

Set olTempFolder = CurrentFolder.Folders(i)

olTempFolderPath = olTempFolder.FolderPath

' Get the count of items in the folder
olCount = olTempFolder.Items.count

Set propertyAccessor = olTempFolder.propertyAccessor

'prints the folder path and name in the VB Editor's Immediate window
Debug.Print olTempFolderPath & " " & olCount

' prints the folder name only
' Debug.Print olTempFolder

' create a string with the folder names.
' use olTempFolder if you want foldernames only
strFolders = strFolders & vbCrLf & olTempFolderPath & vbTab & olCount & " " & _

lCountOfFound = lCountOfFound + 1

' Loop through and search each subfolder of the current folder.
For Each olNewFolder In CurrentFolder.Folders

'Don't need to process the Deleted Items folder
If <> "Deleted Items" Then
ProcessFolder olNewFolder
End If


End Sub

That value is the creation time which is not supported in pst files. I don't see a creation field property in a pst file.

These are the fields available in a pst field. I will need to update my article..


IMAP and exchange have the create date field- and tons more.
Similar threads
Thread starter Title Forum Replies Date
macdotcom Outlook 365 Outlook folder export to PST archival tool - close, but need a nudge Outlook VBA and Custom Forms 2
K Export Folder to PST Outlook VBA and Custom Forms 2
N How to delete default folder "Contacts" (olFolderContacts) in a .pst file Using Outlook 8
G Can't open .pst. Message could not access default folder (Outlook 2010 (.pst). Before that was backi Using Outlook 0
B Search Folder for search messages in more than one account and / or multiple PST folders Using Outlook 3
B Open a folder / subfolder of a PST in single click Outlook VBA and Custom Forms 4
I Random Chinese characters in email copied from a pst file. Exchange Server 2016 Public Folder Exchange Server Administration 1
C Cannot drag and drop or create folder in PST file folders Using Outlook 1
K cannot expand the folder outlook 2007 pst Using Outlook 1
S Deleting Personal folder and IMAP account PST files Using Outlook 0
M VB Code to access PST file and folder not working Using Outlook 1
M How do you keep sent emails in the PST folder in outlook 2013 Using Outlook 1
R Flagged for Follow Up Search folder MIA after PST export/import Using Outlook 1
W Copy individual file folders in Outlook 2010 PST to a My Documents folder Using Outlook 4
B Move Sent Email to archival pst folder and mark as read - HOW TO Outlook VBA and Custom Forms 2
J Macro to create folder in PST file Outlook VBA and Custom Forms 4
A Accessing .pst folder in outlook using VBA Code Outlook VBA and Custom Forms 4
T Cannot open .pst file Using Outlook 2
Rob Can't save MailItem because the message changed in .pst file Outlook VBA and Custom Forms 0
P Recommendation for PST repair program Using Outlook 1
P Outlook 365 Bad experience with KernelAPPS PST Repair program Using Outlook 0
HarvMan Importing PST into IMAP account Using Outlook 12
K Moved pst to new computer, now Gmail not coming into Outlook Using Outlook 7
W Outlook 365 File access denied attempting to import .pst Using Outlook 6
P Copying ALL calendar entries from Calender in PST file to IMAP OST file? Using Outlook 1
S Import PST to Office 365 Using Outlook 1
J Recover server side rules from OST/PST without access to the server Using Outlook 2
D Outlook app 2021 & iCloud PST issues Using Outlook 2
L Restoring Outlook from backup pst file Using Outlook 5
e_a_g_l_e_p_i Kernel Outlook .pst viewer Using Outlook 3
G Outlook Express (DBX) to Outlook (PST) Conversion Software Wanted Using Outlook 1
J Outlook 2003 .pst Will Not Restore Completely to Outlook 2019 Using Outlook 5
J SCANPST errors Outlook PST repair? Using Outlook 1
HarvMan Exporting IMAP OST file to PST Using Outlook 5
J What are .PST.db and .PST.db.journal Files? Using Outlook 2
Abraham Outlook 2013 Lost my folders when moving from PST to IMAP Using Outlook 11
L Article on merging pst file Using Outlook 1
e_a_g_l_e_p_i Changing where data .pst is saved to Using Outlook 3
M Convertor for Outlook Express Mail Store (.dbx) to Outlook Mail Store (.pst) Using Outlook 0
D a general question re how backup programs handle pst files ... I have no problems, just curious Using Outlook 1
R Problem moving file “Email folders.pst” to new PC Using Outlook 5
J Outlook 2019 i dont want to buy the snake oil ost to pst programs Using Outlook 1
D Outlook 2016 Unable to load Outlook data pst file Using Outlook 5
K Need to convert .mmf file to .pst format Outlook VBA and Custom Forms 7
J outlook 2007 doesn't let me choose which .pst to search Using Outlook 2
B Can I create a local PST file for SPAM on a drive that is usually disconnected? Using Outlook 3
P Outlook pst file is too huge with POP3. How to save more space? Using Outlook 4
K Disabling import/export button to restrict PST creation Using Outlook 3
I Outlook 365 - import/attach PST file that used POP3 Using accounts in Outlook 0
HarvMan Outlook 365 PST Report Using Outlook 1

Similar threads