Hi,
We are trying to get the MIMEType of a document based on its file extension. In documentum there is an object called dm_format which can queried by passing the file extension and it returns the MIMEType. Is there some thing similar in DotCMIS?
I found this code. But it is in a java package. But my application is based on dotnet. Is there a similar code that can be used in the dotnet application?
org.alfresco.web.bean.repository.Repository
public static String getMimeTypeForFileName(FacesContext context, String filename)
{
// base the mimetype from the file extension
MimetypeService mimetypeService = (MimetypeService)getServiceRegistry(context).getMimetypeService();
// fall back to binary mimetype if no match found
String mimetype = MimetypeMap.MIMETYPE_BINARY;
int extIndex = filename.lastIndexOf('.');
if (extIndex != -1)
{
String ext = filename.substring(extIndex + 1).toLowerCase();
String mt = mimetypeService.getMimetypesByExtension().get(ext);
if (mt != null)
{
mimetype = mt;
}
}
return mimetype;
}
Regards,
Rita