From LedHed's Wiki
Jump to: navigation, search

There is a limit to the number of duplicate files Outlook can store in cache. If the same file is regularly emailed the attachment will fail to deliver. To remedy this the Outlook cache needs to be cleared regularly, this can be accomplished with a Logon script.

Logon/off Script

On Error Resume Next

Dim strCachePath
Dim strOLPath
Dim strVersion
Dim strRegKey
Dim ma

Set wshObject = WScript.CreateObject("WScript.Shell")
Set FsoObject = CreateObject("Scripting.FileSystemObject")

strOLPath = wshObject.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE\Path")

Set regx = New RegExp
regx.Pattern = "\d{1,2}"
set ma = regx.Execute(strOLPath)

strVersion = ma(ma.count -1) & ".0"

strCachePath = wshObject.RegRead("HKCU\Software\Microsoft\Office\" & strVersion & "\Outlook\Security\OutlookSecureTempFolder")

if (FsoObject.FolderExists(strCachePath)) then	'Check if the folder exists
	FsoObject.DeleteFile strCachePath & "*.*", True	'If the folder exists, then delete everything in it
end if

wscript.echo strCachePath

Files

ClearOutlookCache.zip