Fix Microsoft Outlook Can’t Create File Attachment Issue
Recently while using Microsoft Outlook, I ran into a strange problem while trying to open an attachment that was inside an email. Each time I tried to open the attachment from the email, I would get the error message: “Can’t create file: groovypost.doc. Right-click the folder you want to create the file in, and then click Properties on the shortcut menu to check your permissions for the folder.”
Here’s a screenshot of the error message:
Fortunately, the fix is easy! But first, a little background information on the problem.
Scenario:
The user opens email attachments with the same name multiple times over a period of time as a result of a particular job function and/or workflow. (i.e. The user receives or accesses a public folder with email notifications that contain the same attachment name; to view them, they must repeatedly open them individually through Outlook.)
Every time an email attachment is opened in Outlook, then a cached copy of the attachment is created within an Outlook temporary OLK folder. This folder is generated with a random name and therefore is different for every user. To see this folder, view the registry key from the user’s profile based on their Outlook version. I wrote a post earlier on how to Find the Microsoft Outlook Temporary OLK Folder. Take a look there for a MAP that details the location of the OLK folder for all versions of Outlook.
Solution:
Browse to the Outlook Temp OLK folder (also known as the OutlookSecureTempFolder) and delete all files matching the “<attachment name>(number).” Typically the list of cached attachments is not cleared out automatically and has reached the number of (99). Due to long file names, the cached attachment name is not able to grow any higher, and therefore file creation fails, which sends a notification to the user (hence the error message). But once the cached files are cleared out, the user should once again be able to open the attachments after restarting Outlook.
FYI – As a security measure, I recommend you delete ALL files in the OLK folder regularly OR, encrypt the entire folder using Microsoft EFS.
Inferno999
November 9, 2007 at 1:27 pm
REM OLK_PURGER.BAT by Inferno999
REM This batch file will Scan the registry for all SecureTempFolder locations
REM and purge the folder to allow room for temp items to be created.
REM Each query returns errorlevel 1 if the key is not found or a 0 if it is,
REM at which point it deletes the referenced location.
@echo off
:12
REG QUERY HKEY_CURRENT_USER\Software\Microsoft\Office\12.0
ECHO %ERRORLEVEL%
IF %ERRORLEVEL%==0 (
for /f “tokens=2,*” %%a in (‘”reg query HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Security /v OutlookSecureTempFolder|find “OutlookSecureTempFolder” “‘) do (
rmdir /s /q “%%b”
)
) ELSE (
GOTO 11
)
:11
REG QUERY HKEY_CURRENT_USER\Software\Microsoft\Office\11.0
ECHO %ERRORLEVEL%
IF %ERRORLEVEL%==0 (
for /f “tokens=2,*” %%a in (‘”reg query HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Security /v OutlookSecureTempFolder|find “OutlookSecureTempFolder” “‘) do (
rmdir /s /q “%%b”
)
) ELSE (
GOTO 10
)
:10
REG QUERY HKEY_CURRENT_USER\Software\Microsoft\Office\10.0
ECHO %ERRORLEVEL%
IF %ERRORLEVEL%==0 (
for /f “tokens=2,*” %%a in (‘”reg query HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Security /v OutlookSecureTempFolder|find “OutlookSecureTempFolder” “‘) do (
rmdir /s /q “%%b”
)
) ELSE (
GOTO 9
)
:9
REG QUERY HKEY_CURRENT_USER\Software\Microsoft\Office\9.0
ECHO %ERRORLEVEL%
IF %ERRORLEVEL%==0 (
for /f “tokens=2,*” %%a in (‘”reg query HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Security /v OutlookSecureTempFolder|find “OutlookSecureTempFolder” “‘) do (
rmdir /s /q “%%b”
)
) ELSE (
GOTO end
)
:end
JV
June 3, 2013 at 7:11 pm
Thank you. Worked for me!
Inferno999
November 9, 2007 at 2:42 pm
Scratch that.
Threw another for loop in there to reduce size and clutter:
REM OLK_PURGER.BAT by Inferno999
REM This batch file will Scan the registry for all SecureTempFolder locations
REM and purge found folders, allowing room for temp items to be created.
REM Each query returns errorlevel 1 if the key is not found or a 0 if it is,
REM at which point it deletes the referenced location.
@echo off
SetLocal EnableDelayedExpansion
for /f %%Q in (“12″,”11″,”10″,”9”) do (
REG QUERY HKEY_CURRENT_USER\Software\Microsoft\Office\%%Q.0
ECHO !ErrorLevel!
IF !ErrorLevel!==0 (
for /f “tokens=2,*” %%a in (‘”reg query HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Security /v OutlookSecureTempFolder|find “OutlookSecureTempFolder” “‘) do (
rmdir /s /q “%%b”
)
)
)
EndLocal
sm
February 6, 2008 at 10:04 am
Inferno999,
This is awesome. However, the short version does not work for Office 2003 (and likely for older) due to hardcoded “12.0” in the reg query.
My users often have the problem with many AS/400 reports that are distributed daily as attachements with same name.
Thanks.
SM
Jon Linch
May 9, 2008 at 9:29 am
I looked at the registry and found the OLK location. When I went to looked for it I coild not find the OLK folder. Not sure what to do next. Thanks!
MrGroove
May 10, 2008 at 12:23 pm
@Jon – Welcome to the site!
Hi Jon, did you try to just cut and paste the location found in the registry into the RUN command box? Click Start Button, Run, Paste in OLK location found in the registry. What happens? Does it open or?
You running Vista or XP?
Marc Fabila
May 12, 2008 at 6:47 pm
Hi
Thanks for the tip – just following through the steps has helped me resolve my Outlook problems of opening word attachment files from a particular user . Good stuff.
Marc
OLK Hates Me
June 19, 2008 at 7:28 am
Re: Inferno999
you code there how do i implement that? in the registry or in a bat file? please let me know id love to use it.
Lindseyh
August 4, 2008 at 1:21 pm
Man was I glad to find this. solved an issue we had with a file. she had 1300 items in this folder and we could not get them out.
MrGroove
August 4, 2008 at 1:56 pm
:) Glad it helped you out Lindseyh!
Dgrif
August 6, 2008 at 9:32 am
I have a user with this problem but when we cleared the OLK files and rebooted she’s still getting the error message “Can’t create file…”.
Thoughts?
Dgrif
August 6, 2008 at 10:09 am
Please ignore my earlier post, I just found the problem. The user has multiple OLK folders. I only found this by doing Start, Run, %temp% then going to View, Explorer Bar, Folders.
I was able to look at the users temporary internet files from there and found a separate OLK folder which was full! Obviously this OLK didn’t show up in the user’s registry.
Problem solved.
Shannon
September 16, 2008 at 7:15 am
When I try using the batch file I get the following message:
2 was unexpected at this time.
Any tips?
DDCouncil
December 1, 2008 at 8:29 am
Thanks For The Info. I modifed the more simple batch file.
Copy The Following In A Notepad, Save The Notepad with the Extension ending in .bat
cd C:\Documents and Settings
cd %userprofile%\local settings\temporary internet files\
cd olk*
explorer .
Paul
December 8, 2008 at 4:50 pm
We had a similar problem at work but someone had used another method mentioned in a separate tip that recommended to “just delete the OLK folders.” The problem with this was that the registry key referred to by Inferno999 above still wanted to save the documents in the original OLK folder, but it wasn’t there anymore and Outlook (2003) wouldn’t recreate a new one. To fix the issue I just edited the path in the registry value that specified the temp directory (i.e. the “OLK” file) to a new directory I created. I think the other methods mentioned here are preferred but if you get stuck this could hopefully help.
Coupland
February 10, 2009 at 11:54 am
Be very careful with Duey’s batch in post 14. If your home drive is not C:, then you will be deleting anything in the root.
duey
February 10, 2009 at 11:30 pm
Coupland is right. The batch file should be modified to:
=====
@echo off
C:
cd C:\Documents and Settings
cd %userprofile%\local settings\temporary internet files\
cd OLK*
del /f /q *.*
=====
Change “C:” to the appropriate drive letter to suit your needs.
Stratmn
October 14, 2009 at 8:45 am
@duey, 1st off, Thanks for the great script. Just a not though.
You can also change the command to user the %systemdrive% variable like this:
=====
@echo off
%systemdrive%
cd\
cd %homepath%\local settings\temporary internet files\
cd OLK*
del /f /q *.*
=====
This will change the drive letter to the system root drive regardless of letter.
Roger
March 5, 2009 at 3:13 pm
An easy way to view the secret OLK folders is to revisit your C drive as a “network share”:
Start, Run: \\yourcomputername\c$
Then simply browse to your temporarily internet folder…
\Documents and Settings\%userprofile%\local settings\temporary internet files\
Now you can view and open any OLK## folders and delete the contents as needed. Turns out Windows forgets to protect the OLK folder if you approach it as a network share. BTW this works across the network to other computers you have admin rights to.
Btek
April 1, 2009 at 10:16 am
just wanted to say thanks for the bat file. I have a client that constantly gets this error with their ERP software due to the amount of docs that they email out of it.
great job.
Jimmy O
April 9, 2009 at 6:24 am
I have found a shotcut that let me open the OLK folder.
Under C:\Documents and Settings\User-name\Application Data\Microsoft\Office\Recent
It has been on all the machines in our Office that I have checked so far. Using XP SP2 and Office 2003. The shortcut can be copied to desktop for easy access and will let me see, access and delete the files as I want. You may get a security warning message when you try to open the folder, just continue on and it will open.
sandrar
September 10, 2009 at 1:34 pm
Hi! I was surfing and found your blog post… nice! I love your blog. :) Cheers! Sandra. R.
MrGroove
September 11, 2009 at 12:58 pm
@sandrar,
And I’m glad you did! Welcome to the community Sandra! Feel free to drop any questions you might have in our Free Tech Support Community or help answer questions other people might post there! ;)
Mike Harris
February 23, 2010 at 3:11 pm
Thanks to everyone who has posted. Interesting how some fixes worked for some people and not others, including me. Through all of the clues though, and trial and error, here is what worked for me. First, I looked up the map in the registry key as suggested, then went to the folder mentioned but it was not there. Seems I must have deleted it on my own or through some cleaner program… I have used many. What I did was to change the directory path in the registry key to just the office folder and it worked!!
Rose
March 8, 2010 at 2:26 pm
Thanks to Mike Harris. I was in the same boat. I could not find the folder. The last two extensions were not there. I changed the directory path to last folder in path that I could find and IT WORKED!!!!!!!!!!!
MrGroove
March 8, 2010 at 5:32 pm
Hey glad to hear it worked. Sorry bout that!
titus
April 5, 2010 at 5:17 am
Mike, your solution works for me too. Thanks.
Maranda Kali
August 21, 2010 at 7:41 am
Thanks to you for this awesome article. I’ve read id a couple of months now and they are always very informative. Thanks!
Tim
September 28, 2010 at 2:21 pm
One thing that I have always done and maybe it is wrong let me know.
But I have always used CCLEANER.com (portable version for no install) to clean out the temporary files on the users computers.
It seems to work everytime.
vikram
January 25, 2011 at 3:43 am
thank you. You saved my life today. 300 page document!!!
MrGroove
January 25, 2011 at 2:45 pm
Your welcome! That’s what we do here at groovyPost. We save lives!
;)
Anslem A
February 8, 2011 at 9:56 pm
Hi,
Iam facing the same problem in windows7 and i am not able to find out ‘OutlookSecureTempFolder’ in registry. Though i have msoffice 2007.
Please help
Lisa Beech
March 2, 2011 at 10:14 am
CCleaner will correct this problem too Just run it. I used this solution when I had trouble finding the OutlookSecureTempFolder.
chris
March 8, 2011 at 2:45 pm
c:\documents and settings\username\temporary internet files\content.outlook
;) this will bring you right to the securetemp. you wont be able to view it if your trying to go through explorer unless you put the direct root into the address bar.
Neil Quadros
March 20, 2012 at 5:03 am
Thank you Steve, this has been of much help!
Steve Krause
March 20, 2012 at 10:20 pm
Awesome Neil. Glad it was a help!
Matt Conlon
January 29, 2013 at 1:40 pm
I’ve got a pretty strange outlook problem, if you’d like to try your hand at it…
My client got a brand new Dell laptop, windows 7, 64bit Office standard 2010. All the latest patches, etc.
SOME TIMES when she creates a new email, and tries to attach something to it, it will not show up in the new email, but instead it somehow attaches itself to an email she recieved from someone else…
In other words, let’s say she and I trade emails back and forth a dozen times, and then afterwards she wants to send her friend a picture of something… She opens the new email clicks the paperclip, browses to the file, clicks attach, and instead of showing up in her new email, it will attach itself to one of the emails that I sent her, looking like I sent her an attachment…
I’ve not been able to find a fix for this, and every time I get dell involved trying to invoke the warranty, they think I’m nuts, cause of course, it works fine while they’re watching.
JV
June 3, 2013 at 7:12 pm
Thank you.It worked for me.
Deleted all the files in C:/temp0, problem solved.
Chris
June 7, 2013 at 9:39 am
No problem, was an easy fix.