Solved

How to prevent Outlook temp files from staying in OLK directories.

Posted on 2006-06-20
10
14,083 Views
Last Modified: 2012-08-13
I have noticed that after opening attachments in outlook and then closing the attachments and or saving them and closing outlook the attachments still reside on the PC in temp directory...OLK.  Does anyone know how to prevent these attachments from being stored on the machine once outlook has closed?
0
Comment
Question by:kapara
  • 4
  • 3
  • 3
10 Comments
 
LVL 97

Expert Comment

by:war1
ID: 16945491
Greetings, kapara !

You can manually delete the files from the OLK folder, or write a batch file to delete them

cd C:\Documents and Settings\profilename\Local Settings\Temporary Internet Files\OLK11
del *.*
pause

Reference: http://www.computing.net/programming/wwwboard/forum/14395.html


Best wishes!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 16946084
Hi kapara,

If you want to clean these files up on your computer, then I can provide a simple macro that will run and delete the contents of this folder each time Outlook shuts down.  If you are on a network and use roaming profiles or are concerned about leaving files on other computers where a macro isn't an option, then a manual clean up is going to be required.

Cheers!
0
 
LVL 97

Expert Comment

by:war1
ID: 16975489
kapara,

We have not heard from you. Did any comment help you solve your problem? Do you have any more question? If an Expert helped you, please accept his/her answer above with an excellent or good grade.

Thanks, war1
0
 
LVL 1

Author Comment

by:kapara
ID: 16975787
Sorry for not responding.  Been out of town.  I am interested in a solution that does not require the user to have to perform any action.  This Macro sounds like an interesting solution.  Could you please give me more details?

Thanks
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 16975998
Here's the macro.  Follow these instructions to use it.

1.  Launch Outlook.
2.  Click Tools->Macro->Visual Basic Editor.
3.  In the code editor expand Microsoft Outlook Objects and click on ThisOutlookSession.
4.  Copy the code below and paste it into the right-hand pane of the editor window.
5.  Click the diskette icon on the toolbar to save the changes.
6.  Close the editor.
7.  Click Tools->Macro->Security
8.  Set the security level to Medium.
9.  Close Outlook
10.  Launch Outlook.  You'll receive a prompt asking if you want to enable macros.  You have to enable them for this code to work.
11. Each time Outlook closes it fires the Quit event and the code runs.  It will find Outlook's temporary files folder and delete its contents.


Private Sub Application_Quit()
    Dim objFSO As Object, _
        objTempFilesFolder As Object, _
        objFolder As Object, _
        strProfilePath As String
    strProfilePath = Environ("USERPROFILE")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTempFilesFolder = objFSO.GetFolder(strProfilePath & "\Local Settings\Temporary Internet Files")
    For Each objFolder In objTempFilesFolder.SubFolders
        If Left(objFolder.Name, 3) = "OLK" Then
            objFSO.DeleteFile objFolder.Path & "\*.*", True
        End If
    Next
    Set objFolder = Nothing
    Set objTempFilesFolder = Nothing
    Set objFSO = Nothing
End Sub
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 97

Expert Comment

by:war1
ID: 16976050
kapara,

You can run the batch file that I posted above. 06/20/2006 12:19PM PDT
0
 
LVL 1

Author Comment

by:kapara
ID: 16976480
Thanks guys

BlueDevilFan gave me a solution which is more suited to my requirement in that it requires no user interaction and is automatically executed when Outlook closes.  You say this only applies to local profiles and not roaming profiles.  Is there a way to deploy this macro to all users?  Is there a chance that it can be added via customization of an MST file or have a vbscript which can be run in a logon script which adds the macro to Outlook?


Thanks,
0
 
LVL 76

Expert Comment

by:David Lee
ID: 16976488
It might work okay with roaming profiles once installed.  Unfortunately, there is no way to install a macro from outside Outlook.  It's a shortcomming that Microsoft needs to address.  
0
 
LVL 1

Author Comment

by:kapara
ID: 16976492
Is the macro stored in the user profile or is it a common macro which applies to all users?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 16976501
There is no concept of a common macro in Outlook.  They are all user specific.  Macros are kept in a file named VBAProject.otm.  The file format hasn't been published making it impossible to modify from outside Outlook.  You could overwrite it from a login script so long as you are certain that the users don't have any macros already.  If they did, then you'd wipe theirs out in favor of yours.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Resolve DNS query failed errors for Exchange
If you don't know how to downgrade, my instructions below should be helpful.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now