Hi MON205, thanks for your suggestion. I use the following code to get the
path, but the result of some PST path is invalid, some is valid, it
confuses me a lot. Cause I can get the name in the code without path.
-------
Sub getStores()
Dim objSession As MAPI.Session
Dim objInfoStoresColl As InfoStores
Dim objInfoStore As InfoStore
Dim infS As InfoStore
Dim objFSO As FileSystemObject
Dim objFile As File
Dim PSTSize As Long
Set objSession = CreateObject("MAPI.Session")
objSession.Logon showdialog:=False, newsession:=False
Set objInfoStoresColl = objSession.InfoStores
If objInfoStoresColl Is Nothing Then
MsgBox "Could not set InfoStores collection"
Exit Sub
End If
If 0 = objInfoStoresColl.Count Then
MsgBox "No InfoStores in the collection"
Exit Sub
End If
Dim thePath As String
For i = 1 To objInfoStoresColl.Count
Set objInfoStore = objInfoStoresColl(i)
Dim j As Integer, magicNumber As Integer
magicNumber = 107
thePath = ""
For j = magicNumber To Len(objInfoStore.ID) - 2 Step 2
thePath = thePath & Chr(CInt("&H" & Mid(objInfoStore.ID, j, 2)))
Next j
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(thePath)
PSTSize = objFile.Size / 1024
PSTSize = PSTSize / 1024
MsgBox "i= " & i & Chr(10) & _
"PST File Name= " & objInfoStoresColl(i).Name & Chr(10) & thePath
& Chr(10) & PSTSize & "MB"
Next i
Set objInfoStoresColl = Nothing
objSession.Logoff
End Sub
--------