Solved

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

Posted on 2006-06-20
10
14,072 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 Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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

13 Experts available now in Live!

Get 1:1 Help Now