Search Wiki:
Resource Page Description
This program clears the outlook temporary file location (Outlook Secure Temp Folder)

The programs aim is to help fix a problem within outlook:>>Which is:>>
When outlook is closed unexpectedly, some files are left in the Outlook Secure Temp Folder.
If these files build up (contains around 100), when trying to open futher attachments the system32 folder may be opened or other errors may occur.

What it does:
Step 1: Obtains outlook version (So that It can go to the correct place in the registry, to obtain the outlook secure temp folder location).
Step2 : Goes to appropriate place in registry, and obtains the outlook temporary file location.
Step 3: Closes outlook and goes to the temp file location obtained from the registry and clears down the files contained within.
Step 4: Re-Opens outlook after cleaning - Simple As






Program available from download section. Alternativly, here is the source code>>>>>>>>>>




Imports Microsoft.Win32 'This Import/Namespace is required for the registry actions
Public Class Main_Form


Private Sub btngoClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_go.Click

'Closing Users Outlook before perorming anything.
Try
Dim pProcess As Process() = Process.GetProcessesByName("outlook")
For Each p As Process In pProcess
p.Kill()
Next
Catch ex As Exception
MessageBox.Show("Sorry!,This application has encountered a problem" & vbNewLine & "Please print screen and forward the next message you receive to I.T", "Outlook Temporary File Cleaner Error")
MessageBox.Show(ex.Message, "Outlook Temporary File Cleaner Error")
End Try
'
Call obtainoutlookversion()

End Sub
Private Sub obtainoutlookversion()
'We now need to obtain the outlook version so we can go to the correct
'registry location to obtain the outlook temp location key value.

Dim oApp As Outlook.Application
oApp = New Outlook.Application
Dim version As String = oApp.Version


Dim splits As String() = version.Split("."c)
version = splits(0) & "." & splits(1)

Call obtaintemplocation(version)
End Sub
Private Sub obtaintemplocation(ByVal version)

Dim templocationpath As Object

Try
Dim reg_key As RegistryKey = Registry.CurrentUser
regkey = regkey.OpenSubKey("SOFTWARE\\MICROSOFT\\OFFICE\\" & version & "\\OUTLOOK\\SECURITY")
templocationpath = reg_key.GetValue("OutlookSecureTempFolder")
Catch ex As Exception
MessageBox.Show("Sorry!,This application has encountered a problem" & vbNewLine & "Please print screen and forward the next message you receive to I.T", "Outlook Temporary File Cleaner Error")
MessageBox.Show(ex.Message, "Outlook Temporary File Cleaner Error")
End Try

If templocationpath.contains("OLK") Then
Call cleartemplocation(templocationpath)
Else : MessageBox.Show("Unfortunatley, this program isn't able to clear the files it needs to." & vbNewLine & "Please let I.T know they will have to clear your Temporary Internet Files Manually.")
Process.Start("Outlook.exe")
End If


End Sub
Private Sub cleartemplocation(ByVal templocationpath)

Dim dl As New System.IO.DirectoryInfo(templocationpath)

If dl.Exists = False Then
Call finished()
Else
Try
dl.Delete(True)
Catch ex As Exception
Finally
Call finished()
End Try
End If

End Sub
Private Sub finished()
MessageBox.Show("Files have now been cleared up!" & vbNewLine & "Your outlook will now be re-opened", "Outlook Temporary File Cleaner")
Process.Start("Outlook.exe")
End Sub
Private Sub btnabortClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_abort.Click
Application.Exit()
End Sub


End Class
Last edited Sep 22 2009 at 1:32 PM  by anthonyrsc, version 3
Updating...
Page view tracker