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+

Trisped
  • 5,705
  • 2
  • 45
  • 58
Jury
  • 1,227
  • 3
  • 17
  • 30

1 Answers1

25

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.

Community
  • 1
  • 1
SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173
  • 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? – mrswadge Apr 24 '14 at 07:54
  • 8
    I managed it by creating a key `HKEY_CLASSES_ROOT\.out` then by giving the `(Default) REG_SZ` a value of `txtfile`. – mrswadge Apr 24 '14 at 07:59
  • 1
    VS Code has [feature request](https://github.com/microsoft/vscode/issues/73771) for preview handler. [delphi-preview-handler](https://github.com/RRUZ/delphi-preview-handler) is opensource but unmaintained circa 2017. SmartFTP is bundled with a [Source Code Preview](https://www.smartftp.com/en-us/client/features/sourcepreview) handler that handles a number of modern languages; is a paid option. – PotatoFarmer Feb 09 '20 at 01:37
  • @mrswadge, why you don't write an answer, you will get votes up, thank u – Adir Dayan Mar 14 '21 at 20:33