cancel
Showing results for 
Search instead for 
Did you mean: 

Auto-discover FileType

Tharon_Rivera
Star Collaborator
Star Collaborator

Is there a method that will auto-discover a document's FileType?  I'm looking for something that goes through the same process as if I using the Upload form in the Unity client or uses known extensions that match up to the default system file types.

10 REPLIES 10

Adam_Ryman
Star Contributor
Star Contributor

Tharon,

The Unity Client actually reads the extension of the file that is being brought in to populate the FileType.

Here are 3 ways that you could get the FileType of the document being brought into OnBase:

     1.) You can read in the string of the file that is being brought in, and parse out the extension from the file.

     2.) You can create a PageData object from that file using the Storage class, and then utilize PageData.extension.

     3.) You can use the DocumentType.DefaultFileType of whatever document type the document is being uploaded to.

Thanks,

Adam Ryman - Hyland API Analyst

Adam_Ryman
Star Contributor
Star Contributor

Tharon,

To expand on that, you would have to have your own mapping between the file's extension and the FileType associated with that extension. The mapping that is used by the Unity Client to associate the proper FileType is not exposed to the Unity API.

There is an SCR (#167983) to add this functionality to the Unity API, which I will go ahead and add you too.

Please let me know if there is anything I can clarify.

Thanks,

Adam Ryman - Hyland API Analyst

OK.  That's basically what I was looking for (a method like GetFileTypeFromExtension).  I didn't want to make a custom configuration mapping if I didn't need to, but I will do that for now since it's not currently in the Unity API.

Thanks Adam!

Is there any news here? is SCR (#167983) been added to the Unity API?