2

I am storing NRLs in my SharePoint 2013 site, in a document library. I've made some server configuration to enable the filetype association for icon and context menus, but IIS still doesn't launch the file with Desk Site, it downloads.

Is there a MIME type / Content Type for an NRL?

Glenn Ferrie
  • 10,290
  • 3
  • 42
  • 73

1 Answers1

3

I don't believe there is a MIME type for NRLs

In any case I think the better option is for you to register a custom HttpHandler that understands how to parse NRLs. It would do something like the following:

  1. Parse the NRL for the iManage server, database, doc number, version, etc - NRLs are just text files with an easily understood format
  2. Create a connection to the target iManage database, ensuring you authenticate as the user making the request in SharePoint
  3. Find the target IManDocument using regular iManage API methods
  4. Assert a MIME type based on the IManDocument.Extension property
  5. Attempt to download a copy of the document to a temporary location on the server
  6. Stream the document back to the client

When you authenticate with the iManage server you may need to assume that the Windows user that authenticated with SharePoint corresponds to a user in iManage. Impersonating the user may be important because otherwise users may be able to open privileged documents. If for some reasons this is not important to you then you can of course authenticate using a privileged iManage service account

fivetoniner
  • 131
  • 3
  • +1.. It seems like a decent solution, but I'm not a huge fan of (a) impersonating the user on the server-side and (b) downloading a temporary copy. I think i am going to use registry keys to pick-up my new content-type, but this is my backup plan. thanks! – Glenn Ferrie Apr 12 '16 at 14:04
  • iManage user account impersonation is extremely common and a well-documented feature of the API. I wouldn't shy away from it as it's the only way to be sure that you're respecting the security model, other than by impersonating the Windows user (which to me smells even worse). Similarly, downloading a local copy to the server seems fine to me, and in any case you don't have any other option because the API doesn't offer a method that returns you a document as a byte stream – fivetoniner Apr 14 '16 at 07:51
  • Code for #3 could be as simple as `var doc = db.GetDocument(12345, 1)` where you'd like to fetch document 12345 version 1. You may want to use the `IManDatabase.SearchDocuments` method instead for greater flexibility (and the latter is better if you don't know the version number). Code for #4 is just a simple switch statement on the `IManDocument.Extension` property, e.g. if the returned extension string is .DOCX then you'd return a MIME type of application/ms-word – fivetoniner Apr 14 '16 at 07:56