How to preview code attachments in Outlook?
Asked Answered
R

1

16

I frequently sent or receive mail with source code attachments (.c, .cpp, .h, .js, etc). It would be easier if I could preview these files in Outlook, so I do not need to open in another application.
Preferably, the preview would include syntax highlighting, similar to Visual Studio. Is there a Visual Studio preview plugin for Outlook?

I use Visual Studio 2010 pro and MS Office 2007 Pro+

Revelation answered 13/2, 2012 at 11:20 Comment(0)
C
26

You have (2) options here - you can roll your own or leverage an existing preview handler.

Existing Preview Handlers

Windows Preview Handler Pack: handles aspx, cs, css, js, sql, vb, etc.


Custom Preview Handlers

You should checkout the Preview Handler Framework used by both Windows Shell and Office Outlook. There is a great walkthrough and sample code for building managed previewers in the January 2007 edition of MSDN magazine.

Channel9 has a video presentation describing the managed preview handler.

The Preview Handler Editor will show you what extensions are associated to what previewers.

Preview Handler Registry Configuration describes the registry key configuration used when looking for preview handlers.

Once you have the hook for the previewer in place - it would be up to you how you handle syntax highlighting, etc.

Catchment answered 13/2, 2012 at 18:32 Comment(4)
I would like to extend the existing preview handler to show .out files as text. The same as is done for .log files. Can I tweak a registry entry somewhere to extend the preview file extension types?Bogard
I managed it by creating a key HKEY_CLASSES_ROOT\.out then by giving the (Default) REG_SZ a value of txtfile.Bogard
VS Code has feature request for preview handler. delphi-preview-handler is opensource but unmaintained circa 2017. SmartFTP is bundled with a Source Code Preview handler that handles a number of modern languages; is a paid option.Commodus
@mrswadge, why you don't write an answer, you will get votes up, thank uWispy

© 2022 - 2024 — McMap. All rights reserved.