PST ファイルの場所は、レジストリのプロファイル セクションに保存されます。プロファイル データにアクセスして操作するために設計された、公式にサポートされている API はIProfAdminインターフェイスです ( [IProfAdmin] ボタンをクリックすると、OutlookSpy で操作できます) 。PST パスはPR_PST_PATHプロパティに格納されます。拡張 MAPI には、C++ または Delphi からのみアクセスできます。
ProfManを使用できます(配布可能なバージョンのRedemptionに付属しています)。ProfMan はどの言語からでも使用できます。次のスクリプト (VB) は、すべてのローカル プロファイルから PST ファイル名を取得します。
'Print the path to all the PST files in all profiles
PR_PST_PATH = &H6700001E
set Profiles=CreateObject("ProfMan.Profiles")
for i = 1 to Profiles.Count
set Profile = Profiles.Item(i)
set Services = Profile.Services
Debug.Print "------ Profile: " & Profile.Name & " ------"
for j = 1 to Services.Count
set Service = Services.Item(j)
If (Service.ServiceName = "MSPST MS") or (Service.ServiceName = "MSUPST MS") Then
MsgBox Service.Providers.Item(1).ProfSect.Item(PR_PST_PATH)
End If
next
next
Outlook オブジェクト モデルを使用して PST ストアから PST ファイル名を取得することもできます (ただし、これには Outlook が実行されている必要があり、現在使用されているプロファイルに対してのみ実行できます)。次のStore.FilePathプロパティを使用します。
set vApp = CreateObject("Outlook.Application")
for each vStore in vApp.Session.Stores
MsgBox vStore.DisplayName & " - " & vStore.FilePath
next