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


13 comments:

  1. WONDERFUL Post.thanks for share..more wait ..

    ReplyDelete
    Replies
    1. Thanks Jeremy, I had two nice holidays weeks so I've been a bit quite. But keep in touch, I'll come soon with some nice tips.

      Delete
  2. Does this allow you to save back to sharepoint?

    ReplyDelete
    Replies
    1. That will depend of the application used to open the document. Most of the cases you won't have any trouble saving back the file.

      Delete
    2. Unfortunately it seems like PDFXchange wont allow you to save edits made by program back to the library. Just wasn't sure if this addition in SharePoint enabled that! Thanks great article

      Delete
    3. PDFXChange is one of the applications I use with Sharepoint without any trouble. In fact I picked it because it works with Sharepoint WebDAV. What error are you getting?

      Delete
  3. Just to clarify i have installed PDFXchange Viewer, with the ability to make notations to pdfs.

    The issue i am running into is, when i open a pdf within a document library and click the save button. It tries to save somewhere else on the computer, and not back to the library to overwrite the existing file. It seems i do not have the option to browse to save it back.

    thanks for all your help btw!

    ReplyDelete
    Replies
    1. Yeah I'm using that one too, what version of PDFX are you using?

      Another thing, what versioning setting do you have active in the document library?

      Delete
    2. I am using the latest one (2.5.208), plus the one from November. Right now i am not using any versioning, i also have it set to NOT require documents to be checked out before they can be edited.

      Delete
    3. Now that is weird, I'm using that version also without any catch. What is your browser, OS client version and server version?

      Delete
    4. I have used IE 8,9 and 10, and chrome. Server version is Windows 2008R2 SP1 running Sharepoing 2010.

      Delete
    5. Bummer it has no reason to do that :(. I need to replicate your problem in order to solve it. Is there any chance that we could do some screen sharing?

      Delete
  4. This comment has been removed by the author.

    ReplyDelete