comments 12

Add a new file type in SharePoint – KeePass example

In this post I’ll show you how to enable a new file type in SharePoint.

The goal is simple, for the KeePass database file it should be possible to open them the same way as it works for office documents in SharePoint.

KeePass on SharePoint


The KeePass database file has the extension .kdbx. For this file type we are going to add an icon.

Open the folder C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\IMAGES on your SharePoint server.

Now add this KeePass icon image file to the IMAGES folder: KeePass_Icon

To associate the icon image the file extension we need to add an entry to the DOCICON file.

Edit the file C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\XML\DOCICON.XML and add this line to the <ByExtension> node:

<Mapping Key="kdbx" Value="KeePass_Icon.png" EditText="Keepass Password Manager"/>

Open file

To enable file opening for the database file with the KeePass program run this PowerShell script on the SharePoint server:

# get all webapplications
$SPWebApps = Get-SPWebApplication

# set browser mime type
$mimeType = "application/vnd.keepass"
$SPWebApps | foreach-object { 

    # If the MIME Type is not already on the allowed list for the Web Application 

        # Add the MIME type to the allowed list and update the Web Application 
        Write-Host Added $mimeType to the allowed list for Web Application $_.Name 


        # The MIME type was already allowed - can't add. Inform user 
        Write-Host Skipped Web Application $_.Name - $mimeType was already allowed 

This script adds the KeePass mime type on every SharePoint web application.

Make sure that the SharePoint web application containing the KeePass database file has set the browser file handling permissive.

In case you want to change that with PowerShell run this script on your SharePoint server:

# get all webapplications
$SPWebApps = Get-SPWebApplication

# set global file handling
$SPWebApps | foreach-object {
 if($_.BrowserFileHandling -ne "permissive" ){
      $_.BrowserFileHandling = "permissive" 

Last thing we need to do is to restart the IIS webserver, run the command iisreset.


  1. Nehas


    I get an error ‘The document could not be opened for editing. A Microsoft Sharepoint Foundation compatible application could not be found to edit the document’. Do you have an idea on what could be wrong?

    • Janik von Rotz

      Hi Nehas,

      On your client that .kdbx file have to be associated with the KeePass application. Otherwhise the browser can’t open the file with KeePass. The mime type tells your browser which client application should be used.
      The SharePoint web application’s browser file handling has to be permissive not strict.

      I suppose that you’ll first check wether the mime type is registered, run this command and search for keepass.

      Get-SPWebApplication | ForEach-Object{$_.AllowedInlineDownloadedMimeTypes} | Out-GridView

      It this ok do the same for the browser file handling

      Get-SPWebApplication | ForEach-Object{$_.BrowserFileHandling}

      It has to be permissive

      And don’t forget to check your document library.

      Library Settings > Advanced Settings > Opening Documents in the browser

      The value has to be set to Use the serve default or Open in client application.

      Did you restart the IIS and does SharePoint associate the new file icon?

      Hope this helps

      • Nehas

        woah that was quick πŸ™‚

        To address the points:

        My computer opens .kdbx files with keepass when i double click them.

        Get-SPWebApplication | ForEach-Object{$_.AllowedInlineDownloadedMimeTypes} | Out-GridView – this returns application/vnd.keepass

        Get-SPWebApplication | ForEach-Object{$_.BrowserFileHandling} – returns permissive

        I just changed settings in library to open in a client application as it was default, restarted IIS, but this did not help.

        I did restart IIS and sharepoint show the new file icon.


        If i click straight on the .kdbx file it offers me to read or edit the file
        when i press read iexplorer will popup open/save dialog at the bottom
        when i press edit it pops up the message ‘The document could not be opened for editing…’

        If press ‘edit file in keepass’ it will pop up same message that it could not be opened.

        Sharepoint and my computer are on different domains so I use administrators login, maybe that could be an issue? Or maybe you have some more ideas?

        • Janik von Rotz

          Can you access the file with the fileshare url without being prompted for a login? Enter your specific url in the windows explorer:


          or without the file:


          Basically SharePoint provides a WebDAV access to the KeePass file, if this doesn’t work KeePass won’t be able to open the file.

          • Nehas

            Thank you! That was part of the solution! It was still not working on my pc so I tried on my colleague PC and did work. After updating IE to IE 11 it started working πŸ™‚ Thanks again

          • Janik von Rotz

            Nice to hear that πŸ˜€ So was it your pc or IE?

        • Karl

          We have one WebApplication wich is not working but all others work fine with same configuration.. In the faulty WebAppication it takes a few seconds and then KeePass want to opend the file localy “C:Users..”

          Get-SPWebApplication | ForEach-Object{$_.BrowserFileHandling}


          Skipped Web
          Application AppDummy – application/vnd.keepass was already allowed
          Skipped Web
          Application Collaboration – application/vnd.keepass was already allowed
          Skipped Web
          Application Extranet – application/vnd.keepass was already allowed
          Skipped Web
          Application Intranet – application/vnd.keepass was already allowed
          Skipped Web Application

          MySite – application/vnd.keepass was already allowed

          We also checked web.config, Authentication Provider about differences – any other ideas?

          • Karl

            If we open the Link directly via the KeePass Software it works on all WebApplications

    • Janik von Rotz

      Well, would be nice if you give it a try πŸ˜‰ If the PowerShell APIs for SharePoint haven’t changed, there shouldn’t be a problem.

    • Janik von Rotz

      Checkout the cmdlets for sharepoint online. You might still be able to configure it the same way. Not sure about the WebDAV support. As far as I remember KeePass access the file via WebDAV, not sure though.

Leave a Reply