Winapi 如何查找Outlook.pst文件的完整路径?
是否有方法通过API调用或注册表项以编程方式查找当前用户Outlook.pst文件的位置?路径应位于以下位置: [HKEY\ U当前\用户\软件\ Microsoft\Windows NT\CurrentVersion\Windows消息传递 子系统\Profiles\Outlook] 这可能会有所帮助。使用,您可以使用Winapi 如何查找Outlook.pst文件的完整路径?,winapi,vba,outlook,registry,pst,Winapi,Vba,Outlook,Registry,Pst,是否有方法通过API调用或注册表项以编程方式查找当前用户Outlook.pst文件的位置?路径应位于以下位置: [HKEY\ U当前\用户\软件\ Microsoft\Windows NT\CurrentVersion\Windows消息传递 子系统\Profiles\Outlook] 这可能会有所帮助。使用,您可以使用RDOStores集合在VBA中迭代消息存储,该集合可通过RDOSession.stores属性访问 我正在研究在开箱即用VBA中执行类似操作的可能性 编辑: 显然,PST的路径
RDOStores
集合在VBA中迭代消息存储,该集合可通过RDOSession.stores
属性访问
我正在研究在开箱即用VBA中执行类似操作的可能性
编辑:
显然,PST的路径编码在StoreId字符串中。谷歌出现了:
刚刚测试过,按设计工作。赎回的便利性在于它显式公开RDOPstStore.PstPath属性(),而无需破解商店条目id。
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