WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

List Outlook Personal Folders PST Files


;***************************************************************************
;**
;**   Get PST File Path using Outlooks COM Object Model
;**
;***************************************************************************

#DefineFunction GetPSTPath(input)
   strPath = ""
   For i = 1 To StrLen(input) By 2
      strSubString = StrSub(input,i,2)
      If strSubString != "00" Then
         strPath = strPath : ChrHexToString(strSubString);  ChrW("&H" & strSubString)
      EndIf
   Next
   Select @TRUE
   Case StrIndex( strPath, ":\", 1, @FWDSCAN ) > 0
      result = StrSub( strPath, StrIndex( strPath, ":\", 1, @FWDSCAN )-1, -1 )
      Break
   Case StrIndex( strPath, "\\", 1, @FWDSCAN ) > 0
      result = StrSub( strPath, StrIndex( strPath, "\\", 1, @FWDSCAN ), -1 )
      Break
   EndSelect
   Return result
#EndFunction

objOL = ObjectCreate("Outlook.Application")
objFolders = objOL.Session.Folders
For j = objFolders.Count To 1 By -1
   objFolder = objFolders.Item(j)
   StrIndexNC( objFolder.Name, "Public Folders", 1, @FWDSCAN)
   If (StrIndexNC( objFolder.Name, "Mailbox", 1, @FWDSCAN)==0) && (StrIndexNC( objFolder.Name, "Public Folders", 1, @FWDSCAN)== 0)
      pst_path = GetPSTPath(objFolder.storeid)
      Pause("Folder name: " :objFolder.Name, pst_path )
   EndIf
Next

;Clean up
objOL = 0
Exit


Older code sample:
strKeyPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\"
strSubKey = RegQueryValue(@REGCURRENT, StrCat(strKeyPath,"[DefaultProfile]"))
strSubKeyPath = StrCat(strKeyPath,strSubKey)
keyhandle = RegOpenKey(@REGCURRENT, strSubKeyPath)
keylist = RegQueryKeys( keyhandle )
EndVal = ""
count = ItemCount( keylist, @TAB )
For xx = 1 To count
   keyname = ItemExtract( xx, keylist, @TAB )
   If RegExistValue( keyhandle, StrCat(keyname,"[001e6700]" ))
      pst = RegQueryValue( keyhandle, StrCat(keyname,"[001e6700]" ))
      pstname = RegQueryValue( keyhandle, StrCat(keyname,"[001e3001]" ))
      Message(pstname, pst)
   EndIf
Next

;Cleanup
RegCloseKey(keyhandle)

Article ID:   W17227
File Created: 2012:10:02:14:45:24
Last Updated: 2012:10:02:14:45:24