Outlook displaying the Red X mark instead of the Image

This was a fun issue to troubleshoot! The problem : Compose a new mail in Outlook 2010, Insert a image and send it to yourself. The expected behavior is that when you open the received mail, you see the Image.

In this case, instead of the Image we saw Red X mark with the message “The linked image cannot be displayed.  The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location.”

image

The interesting part was that everything worked fine in Safe mode! What could be causing this issue?
In general, when we open an Item that has embedded images, the images are copied to a temp location which is then used for displaying the image. When the Item is closed the Images are deleted from that location. On further troubleshooting and debugging the issue, we noticed that in this case the Images never got created!

Knowing this was a BIG help to track down this issue. The question: Where is the temp location picked up from and does it really exist? On debugging we found that Outlook was reading the value from the follow key:

 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Cache

The value that was read in this case was %CACHEDIR%\Cache . Is this the right value? I guess NOT. In a working case it gives us the full path to the Temporary Internet Files, something like “C:\Documents and Settings\username\Local Settings\Temporary Internet Files”

When I looked at a few machine in my environment the values were as below:

On a Windows XP machine: %USERPROFILE%\Local Settings\Temporary Internet Files

On a Windows 7 machine: %USERPROFILE%\AppData\Local\Microsoft\Windows\Temporary Internet Files

 

In this case the problem machine was a Windows XP machine, we replaced %CACHEDIR%\Cache with %USERPROFILE%\Local Settings\Temporary Internet Files and then restarted Outlook.

Now everything WORKS?

Why did it work in Safe mode? In Safe mode, Outlook takes a different code path and a different API to get the temp folder location and does that successfully!

Enjoy!