Pages

30 July, 2012

Add a new file type

Ok here is another nice tip. I recently needed to add to the context menu (ECB menu) of a file the "Edit in ..." command. Basically, if the native application is WebDav compatible I want to be able to edit any file for the referenced application, just from the browser, instead of navigating throw the Explorer View. (This will only work for Internet Explorer)

Like this:


Check it out, this is pretty fast yet very helpfull.
1. Create an icon file
Use your favorite image editor to create an image file with 16x16, preferebly PNG format.
And save the image file into the server folder %COMMONPROGRAMFILES%\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES

2. Edit the DOCICON.XML file (backup the file first ;-))
Next open, using your favorite text editor, the docicon.xml file located in the server folder %COMMONPROGRAMFILES%\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML.

Add one line for each file type like this:

<Mapping Key="pdf" Value="pdf.png" EditText="PDF-XChange Viewer" OpenControl="SharePoint.OpenDocuments"/>

Just change:
  • Key="pdf" to Key="your_file_extension"
  • Value="pdf.png" to Key="image_file_name" (created in first step)
  • EditText="PDF-XChange Viewer" to Edit="name_of_the_native_application" (this is the name that will appear in the context menu (ECB)
3. Reset server and try
All done, just iisreset your server and try it.


If you want to keep in touch, feel free to Subscribe to How I did it - Sharepoint Foundation 2010