The DocumentImporter.ImportEDoc method is what you need to use and it requires the mimetype as an input. The following code is a VB example:
Protected Overrides Sub Execute()
'Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session
Dim sFile As String = GetTokenValue("FilePathTokenName").ToString()
Dim sDocName As String = GetTokenValue("DocNameTokenName").ToString()
SetTokenValue("FilePath", sFile)
SetTokenValue("DocName", sDocName)
Try
Dim f As New System.IO.FileInfo(sFile)
If f.Exists Then
Dim sVolumeName = "DEFAULT"
Using Doc as DocumentInfo = New DocumentInfo(RASession)
Using Parent as FolderInfo = Folder.GetFolderInfo(sFolderPath, RASession)
Doc.Create(Parent, sDocName, sVolumeName, EntryNameOption.AutoRename)
Dim DI as DocumentImporter = New DocumentImporter()
DI.Document = Doc
DI.ImportEdoc(GetMimeType(f.Extension), sWinFilePath)
End Using
End Using
End If
Catch ex As Exception
sError = ex.Message
End Try
If String.IsNullOrEmpty(sError) Then
sError = "None"
End If
SetTokenValue("ScriptError", sError)
End Sub
#Region "Mime Type"
Private _mappings As IDictionary(Of String, String) = New Dictionary(Of String, String)(StringComparer.InvariantCultureIgnoreCase) From { _
{".323", "text/h323"}, _
{".3g2", "video/3gpp2"}, _
{".3gp", "video/3gpp"}, _
{".3gp2", "video/3gpp2"}, _
{".3gpp", "video/3gpp"}, _
{".7z", "application/x-7z-compressed"}, _
{".aa", "audio/audible"}, _
{".AAC", "audio/aac"}, _
{".aaf", "application/octet-stream"}, _
{".aax", "audio/vnd.audible.aax"}, _
{".ac3", "audio/ac3"}, _
{".aca", "application/octet-stream"}, _
{".accda", "application/msaccess.addin"}, _
{".accdb", "application/msaccess"}, _
{".accdc", "application/msaccess.cab"}, _
{".accde", "application/msaccess"}, _
{".accdr", "application/msaccess.runtime"}, _
{".accdt", "application/msaccess"}, _
{".accdw", "application/msaccess.webapplication"}, _
{".accft", "application/msaccess.ftemplate"}, _
{".acx", "application/internet-property-stream"}, _
{".AddIn", "text/xml"}, _
{".ade", "application/msaccess"}, _
{".adobebridge", "application/x-bridge-url"}, _
{".adp", "application/msaccess"}, _
{".ADT", "audio/vnd.dlna.adts"}, _
{".ADTS", "audio/aac"}, _
{".afm", "application/octet-stream"}, _
{".ai", "application/postscript"}, _
{".aif", "audio/x-aiff"}, _
{".aifc", "audio/aiff"}, _
{".aiff", "audio/aiff"}, _
{".air", "application/vnd.adobe.air-application-installer-package+zip"}, _
{".amc", "application/x-mpeg"}, _
{".application", "application/x-ms-application"}, _
{".art", "image/x-jg"}, _
{".asa", "application/xml"}, _
{".asax", "application/xml"}, _
{".ascx", "application/xml"}, _
{".asd", "application/octet-stream"}, _
{".asf", "video/x-ms-asf"}, _
{".ashx", "application/xml"}, _
{".asi", "application/octet-stream"}, _
{".asm", "text/plain"}, _
{".asmx", "application/xml"}, _
{".aspx", "application/xml"}, _
{".asr", "video/x-ms-asf"}, _
{".asx", "video/x-ms-asf"}, _
{".atom", "application/atom+xml"}, _
{".au", "audio/basic"}, _
{".avi", "video/x-msvideo"}, _
{".axs", "application/olescript"}, _
{".bas", "text/plain"}, _
{".bcpio", "application/x-bcpio"}, _
{".bin", "application/octet-stream"}, _
{".bmp", "image/bmp"}, _
{".c", "text/plain"}, _
{".cab", "application/octet-stream"}, _
{".caf", "audio/x-caf"}, _
{".calx", "application/vnd.ms-office.calx"}, _
{".cat", "application/vnd.ms-pki.seccat"}, _
{".cc", "text/plain"}, _
{".cd", "text/plain"}, _
{".cdda", "audio/aiff"}, _
{".cdf", "application/x-cdf"}, _
{".cer", "application/x-x509-ca-cert"}, _
{".chm", "application/octet-stream"}, _
{".class", "application/x-java-applet"}, _
{".clp", "application/x-msclip"}, _
{".cmx", "image/x-cmx"}, _
{".cnf", "text/plain"}, _
{".cod", "image/cis-cod"}, _
{".config", "application/xml"}, _
{".contact", "text/x-ms-contact"}, _
{".coverage", "application/xml"}, _
{".cpio", "application/x-cpio"}, _
{".cpp", "text/plain"}, _
{".crd", "application/x-mscardfile"}, _
{".crl", "application/pkix-crl"}, _
{".crt", "application/x-x509-ca-cert"}, _
{".cs", "text/plain"}, _
{".csdproj", "text/plain"}, _
{".csh", "application/x-csh"}, _
{".csproj", "text/plain"}, _
{".css", "text/css"}, _
{".csv", "text/csv"}, _
{".cur", "application/octet-stream"}, _
{".cxx", "text/plain"}, _
{".dat", "application/octet-stream"}, _
{".datasource", "application/xml"}, _
{".dbproj", "text/plain"}, _
{".dcr", "application/x-director"}, _
{".def", "text/plain"}, _
{".deploy", "application/octet-stream"}, _
{".der", "application/x-x509-ca-cert"}, _
{".dgml", "application/xml"}, _
{".dib", "image/bmp"}, _
{".dif", "video/x-dv"}, _
{".dir", "application/x-director"}, _
{".disco", "text/xml"}, _
{".dll", "application/x-msdownload"}, _
{".dll.config", "text/xml"}, _
{".dlm", "text/dlm"}, _
{".doc", "application/msword"}, _
{".docm", "application/vnd.ms-word.document.macroEnabled.12"}, _
{".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"}, _
{".dot", "application/msword"}, _
{".dotm", "application/vnd.ms-word.template.macroEnabled.12"}, _
{".dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template"}, _
{".dsp", "application/octet-stream"}, _
{".dsw", "text/plain"}, _
{".dtd", "text/xml"}, _
{".dtsConfig", "text/xml"}, _
{".dv", "video/x-dv"}, _
{".dvi", "application/x-dvi"}, _
{".dwf", "drawing/x-dwf"}, _
{".dwp", "application/octet-stream"}, _
{".dxr", "application/x-director"}, _
{".eml", "message/rfc822"}, _
{".emz", "application/octet-stream"}, _
{".eot", "application/octet-stream"}, _
{".eps", "application/postscript"}, _
{".etl", "application/etl"}, _
{".etx", "text/x-setext"}, _
{".evy", "application/envoy"}, _
{".exe", "application/octet-stream"}, _
{".exe.config", "text/xml"}, _
{".fdf", "application/vnd.fdf"}, _
{".fif", "application/fractals"}, _
{".filters", "Application/xml"}, _
{".fla", "application/octet-stream"}, _
{".flr", "x-world/x-vrml"}, _
{".flv", "video/x-flv"}, _
{".fsscript", "application/fsharp-script"}, _
{".fsx", "application/fsharp-script"}, _
{".generictest", "application/xml"}, _
{".gif", "image/gif"}, _
{".group", "text/x-ms-group"}, _
{".gsm", "audio/x-gsm"}, _
{".gtar", "application/x-gtar"}, _
{".gz", "application/x-gzip"}, _
{".h", "text/plain"}, _
{".hdf", "application/x-hdf"}, _
{".hdml", "text/x-hdml"}, _
{".hhc", "application/x-oleobject"}, _
{".hhk", "application/octet-stream"}, _
{".hhp", "application/octet-stream"}, _
{".hlp", "application/winhlp"}, _
{".hpp", "text/plain"}, _
{".hqx", "application/mac-binhex40"}, _
{".hta", "application/hta"}, _
{".htc", "text/x-component"}, _
{".htm", "text/html"}, _
{".html", "text/html"}, _
{".htt", "text/webviewhtml"}, _
{".hxa", "application/xml"}, _
{".hxc", "application/xml"}, _
{".hxd", "application/octet-stream"}, _
{".hxe", "application/xml"}, _
{".hxf", "application/xml"}, _
{".hxh", "application/octet-stream"}, _
{".hxi", "application/octet-stream"}, _
{".hxk", "application/xml"}, _
{".hxq", "application/octet-stream"}, _
{".hxr", "application/octet-stream"}, _
{".hxs", "application/octet-stream"}, _
{".hxt", "text/html"}, _
{".hxv", "application/xml"}, _
{".hxw", "application/octet-stream"}, _
{".hxx", "text/plain"}, _
{".i", "text/plain"}, _
{".ico", "image/x-icon"}, _
{".ics", "application/octet-stream"}, _
{".idl", "text/plain"}, _
{".ief", "image/ief"}, _
{".iii", "application/x-iphone"}, _
{".inc", "text/plain"}, _
{".inf", "application/octet-stream"}, _
{".inl", "text/plain"}, _
{".ins", "application/x-internet-signup"}, _
{".ipa", "application/x-itunes-ipa"}, _
{".ipg", "application/x-itunes-ipg"}, _
{".ipproj", "text/plain"}, _
{".ipsw", "application/x-itunes-ipsw"}, _
{".iqy", "text/x-ms-iqy"}, _
{".isp", "application/x-internet-signup"}, _
{".ite", "application/x-itunes-ite"}, _
{".itlp", "application/x-itunes-itlp"}, _
{".itms", "application/x-itunes-itms"}, _
{".itpc", "application/x-itunes-itpc"}, _
{".IVF", "video/x-ivf"}, _
{".jar", "application/java-archive"}, _
{".java", "application/octet-stream"}, _
{".jck", "application/liquidmotion"}, _
{".jcz", "application/liquidmotion"}, _
{".jfif", "image/pjpeg"}, _
{".jnlp", "application/x-java-jnlp-file"}, _
{".jpb", "application/octet-stream"}, _
{".jpe", "image/jpeg"}, _
{".jpeg", "image/jpeg"}, _
{".jpg", "image/jpeg"}, _
{".js", "application/x-javascript"}, _
{".json", "application/json"}, _
{".jsx", "text/jscript"}, _
{".jsxbin", "text/plain"}, _
{".latex", "application/x-latex"}, _
{".library-ms", "application/windows-library+xml"}, _
{".lit", "application/x-ms-reader"}, _
{".loadtest", "application/xml"}, _
{".lpk", "application/octet-stream"}, _
{".lsf", "video/x-la-asf"}, _
{".lst", "text/plain"}, _
{".lsx", "video/x-la-asf"}, _
{".lzh", "application/octet-stream"}, _
{".m13", "application/x-msmediaview"}, _
{".m14", "application/x-msmediaview"}, _
{".m1v", "video/mpeg"}, _
{".m2t", "video/vnd.dlna.mpeg-tts"}, _
{".m2ts", "video/vnd.dlna.mpeg-tts"}, _
{".m2v", "video/mpeg"}, _
{".m3u", "audio/x-mpegurl"}, _
{".m3u8", "audio/x-mpegurl"}, _
{".m4a", "audio/m4a"}, _
{".m4b", "audio/m4b"}, _
{".m4p", "audio/m4p"}, _
{".m4r", "audio/x-m4r"}, _
{".m4v", "video/x-m4v"}, _
{".mac", "image/x-macpaint"}, _
{".mak", "text/plain"}, _
{".man", "application/x-troff-man"}, _
{".manifest", "application/x-ms-manifest"}, _
{".map", "text/plain"}, _
{".master", "application/xml"}, _
{".mda", "application/msaccess"}, _
{".mdb", "application/x-msaccess"}, _
{".mde", "application/msaccess"}, _
{".mdp", "application/octet-stream"}, _
{".me", "application/x-troff-me"}, _
{".mfp", "application/x-shockwave-flash"}, _
{".mht", "message/rfc822"}, _
{".mhtml", "message/rfc822"}, _
{".mid", "audio/mid"}, _
{".midi", "audio/mid"}, _
{".mix", "application/octet-stream"}, _
{".mk", "text/plain"}, _
{".mmf", "application/x-smaf"}, _
{".mno", "text/xml"}, _
{".mny", "application/x-msmoney"}, _
{".mod", "video/mpeg"}, _
{".mov", "video/quicktime"}, _
{".movie", "video/x-sgi-movie"}, _
{".mp2", "video/mpeg"}, _
{".mp2v", "video/mpeg"}, _
{".mp3", "audio/mpeg"}, _
{".mp4", "video/mp4"}, _
{".mp4v", "video/mp4"}, _
{".mpa", "video/mpeg"}, _
{".mpe", "video/mpeg"}, _
{".mpeg", "video/mpeg"}, _
{".mpf", "application/vnd.ms-mediapackage"}, _
{".mpg", "video/mpeg"}, _
{".mpp", "application/vnd.ms-project"}, _
{".mpv2", "video/mpeg"}, _
{".mqv", "video/quicktime"}, _
{".ms", "application/x-troff-ms"}, _
{".msi", "application/octet-stream"}, _
{".mso", "application/octet-stream"}, _
{".mts", "video/vnd.dlna.mpeg-tts"}, _
{".mtx", "application/xml"}, _
{".mvb", "application/x-msmediaview"}, _
{".mvc", "application/x-miva-compiled"}, _
{".mxp", "application/x-mmxp"}, _
{".nc", "application/x-netcdf"}, _
{".nsc", "video/x-ms-asf"}, _
{".nws", "message/rfc822"}, _
{".ocx", "application/octet-stream"}, _
{".oda", "application/oda"}, _
{".odc", "text/x-ms-odc"}, _
{".odh", "text/plain"}, _
{".odl", "text/plain"}, _
{".odp", "application/vnd.oasis.opendocument.presentation"}, _
{".ods", "application/oleobject"}, _
{".odt", "application/vnd.oasis.opendocument.text"}, _
{".one", "application/onenote"}, _
{".onea", "application/onenote"}, _
{".onepkg", "application/onenote"}, _
{".onetmp", "application/onenote"}, _
{".onetoc", "application/onenote"}, _
{".onetoc2", "application/onenote"}, _
{".orderedtest", "application/xml"}, _
{".osdx", "application/opensearchdescription+xml"}, _
{".p10", "application/pkcs10"}, _
{".p12", "application/x-pkcs12"}, _
{".p7b", "application/x-pkcs7-certificates"}, _
{".p7c", "application/pkcs7-mime"}, _
{".p7m", "application/pkcs7-mime"}, _
{".p7r", "application/x-pkcs7-certreqresp"}, _
{".p7s", "application/pkcs7-signature"}, _
{".pbm", "image/x-portable-bitmap"}, _
{".pcast", "application/x-podcast"}, _
{".pct", "image/pict"}, _
{".pcx", "application/octet-stream"}, _
{".pcz", "application/octet-stream"}, _
{".pdf", "application/pdf"}, _
{".pfb", "application/octet-stream"}, _
{".pfm", "application/octet-stream"}, _
{".pfx", "application/x-pkcs12"}, _
{".pgm", "image/x-portable-graymap"}, _
{".pic", "image/pict"}, _
{".pict", "image/pict"}, _
{".pkgdef", "text/plain"}, _
{".pkgundef", "text/plain"}, _
{".pko", "application/vnd.ms-pki.pko"}, _
{".pls", "audio/scpls"}, _
{".pma", "application/x-perfmon"}, _
{".pmc", "application/x-perfmon"}, _
{".pml", "application/x-perfmon"}, _
{".pmr", "application/x-perfmon"}, _
{".pmw", "application/x-perfmon"}, _
{".png", "image/png"}, _
{".pnm", "image/x-portable-anymap"}, _
{".pnt", "image/x-macpaint"}, _
{".pntg", "image/x-macpaint"}, _
{".pnz", "image/png"}, _
{".pot", "application/vnd.ms-powerpoint"}, _
{".potm", "application/vnd.ms-powerpoint.template.macroEnabled.12"}, _
{".potx", "application/vnd.openxmlformats-officedocument.presentationml.template"}, _
{".ppa", "application/vnd.ms-powerpoint"}, _
{".ppam", "application/vnd.ms-powerpoint.addin.macroEnabled.12"}, _
{".ppm", "image/x-portable-pixmap"}, _
{".pps", "application/vnd.ms-powerpoint"}, _
{".ppsm", "application/vnd.ms-powerpoint.slideshow.macroEnabled.12"}, _
{".ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow"}, _
{".ppt", "application/vnd.ms-powerpoint"}, _
{".pptm", "application/vnd.ms-powerpoint.presentation.macroEnabled.12"}, _
{".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"}, _
{".prf", "application/pics-rules"}, _
{".prm", "application/octet-stream"}, _
{".prx", "application/octet-stream"}, _
{".ps", "application/postscript"}, _
{".psc1", "application/PowerShell"}, _
{".psd", "application/octet-stream"}, _
{".psess", "application/xml"}, _
{".psm", "application/octet-stream"}, _
{".psp", "application/octet-stream"}, _
{".pub", "application/x-mspublisher"}, _
{".pwz", "application/vnd.ms-powerpoint"}, _
{".qht", "text/x-html-insertion"}, _
{".qhtm", "text/x-html-insertion"}, _
{".qt", "video/quicktime"}, _
{".qti", "image/x-quicktime"}, _
{".qtif", "image/x-quicktime"}, _
{".qtl", "application/x-quicktimeplayer"}, _
{".qxd", "application/octet-stream"}, _
{".ra", "audio/x-pn-realaudio"}, _
{".ram", "audio/x-pn-realaudio"}, _
{".rar", "application/octet-stream"}, _
{".ras", "image/x-cmu-raster"}, _
{".rat", "application/rat-file"}, _
{".rc", "text/plain"}, _
{".rc2", "text/plain"}, _
{".rct", "text/plain"}, _
{".rdlc", "application/xml"}, _
{".resx", "application/xml"}, _
{".rf", "image/vnd.rn-realflash"}, _
{".rgb", "image/x-rgb"}, _
{".rgs", "text/plain"}, _
{".rm", "application/vnd.rn-realmedia"}, _
{".rmi", "audio/mid"}, _
{".rmp", "application/vnd.rn-rn_music_package"}, _
{".roff", "application/x-troff"}, _
{".rpm", "audio/x-pn-realaudio-plugin"}, _
{".rqy", "text/x-ms-rqy"}, _
{".rtf", "application/rtf"}, _
{".rtx", "text/richtext"}, _
{".ruleset", "application/xml"}, _
{".s", "text/plain"}, _
{".safariextz", "application/x-safari-safariextz"}, _
{".scd", "application/x-msschedule"}, _
{".sct", "text/scriptlet"}, _
{".sd2", "audio/x-sd2"}, _
{".sdp", "application/sdp"}, _
{".sea", "application/octet-stream"}, _
{".searchConnector-ms", "application/windows-search-connector+xml"}, _
{".setpay", "application/set-payment-initiation"}, _
{".setreg", "application/set-registration-initiation"}, _
{".settings", "application/xml"}, _
{".sgimb", "application/x-sgimb"}, _
{".sgml", "text/sgml"}, _
{".sh", "application/x-sh"}, _
{".shar", "application/x-shar"}, _
{".shtml", "text/html"}, _
{".sit", "application/x-stuffit"}, _
{".sitemap", "application/xml"}, _
{".skin", "application/xml"}, _
{".sldm", "application/vnd.ms-powerpoint.slide.macroEnabled.12"}, _
{".sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide"}, _
{".slk", "application/vnd.ms-excel"}, _
{".sln", "text/plain"}, _
{".slupkg-ms", "application/x-ms-license"}, _
{".smd", "audio/x-smd"}, _
{".smi", "application/octet-stream"}, _
{".smx", "audio/x-smd"}, _
{".smz", "audio/x-smd"}, _
{".snd", "audio/basic"}, _
{".snippet", "application/xml"}, _
{".snp", "application/octet-stream"}, _
{".sol", "text/plain"}, _
{".sor", "text/plain"}, _
{".spc", "application/x-pkcs7-certificates"}, _
{".spl", "application/futuresplash"}, _
{".src", "application/x-wais-source"}, _
{".srf", "text/plain"}, _
{".SSISDeploymentManifest", "text/xml"}, _
{".ssm", "application/streamingmedia"}, _
{".sst", "application/vnd.ms-pki.certstore"}, _
{".stl", "application/vnd.ms-pki.stl"}, _
{".sv4cpio", "application/x-sv4cpio"}, _
{".sv4crc", "application/x-sv4crc"}, _
{".svc", "application/xml"}, _
{".swf", "application/x-shockwave-flash"}, _
{".t", "application/x-troff"}, _
{".tar", "application/x-tar"}, _
{".tcl", "application/x-tcl"}, _
{".testrunconfig", "application/xml"}, _
{".testsettings", "application/xml"}, _
{".tex", "application/x-tex"}, _
{".texi", "application/x-texinfo"}, _
{".texinfo", "application/x-texinfo"}, _
{".tgz", "application/x-compressed"}, _
{".thmx", "application/vnd.ms-officetheme"}, _
{".thn", "application/octet-stream"}, _
{".tif", "image/tiff"}, _
{".tiff", "image/tiff"}, _
{".tlh", "text/plain"}, _
{".tli", "text/plain"}, _
{".toc", "application/octet-stream"}, _
{".tr", "application/x-troff"}, _
{".trm", "application/x-msterminal"}, _
{".trx", "application/xml"}, _
{".ts", "video/vnd.dlna.mpeg-tts"}, _
{".tsv", "text/tab-separated-values"}, _
{".ttf", "application/octet-stream"}, _
{".tts", "video/vnd.dlna.mpeg-tts"}, _
{".txt", "text/plain"}, _
{".u32", "application/octet-stream"}, _
{".uls", "text/iuls"}, _
{".user", "text/plain"}, _
{".ustar", "application/x-ustar"}, _
{".vb", "text/plain"}, _
{".vbdproj", "text/plain"}, _
{".vbk", "video/mpeg"}, _
{".vbproj", "text/plain"}, _
{".vbs", "text/vbscript"}, _
{".vcf", "text/x-vcard"}, _
{".vcproj", "Application/xml"}, _
{".vcs", "text/plain"}, _
{".vcxproj", "Application/xml"}, _
{".vddproj", "text/plain"}, _
{".vdp", "text/plain"}, _
{".vdproj", "text/plain"}, _
{".vdx", "application/vnd.ms-visio.viewer"}, _
{".vml", "text/xml"}, _
{".vscontent", "application/xml"}, _
{".vsct", "text/xml"}, _
{".vsd", "application/vnd.visio"}, _
{".vsi", "application/ms-vsi"}, _
{".vsix", "application/vsix"}, _
{".vsixlangpack", "text/xml"}, _
{".vsixmanifest", "text/xml"}, _
{".vsmdi", "application/xml"}, _
{".vspscc", "text/plain"}, _
{".vss", "application/vnd.visio"}, _
{".vsscc", "text/plain"}, _
{".vssettings", "text/xml"}, _
{".vssscc", "text/plain"}, _
{".vst", "application/vnd.visio"}, _
{".vstemplate", "text/xml"}, _
{".vsto", "application/x-ms-vsto"}, _
{".vsw", "application/vnd.visio"}, _
{".vsx", "application/vnd.visio"}, _
{".vtx", "application/vnd.visio"}, _
{".wav", "audio/wav"}, _
{".wave", "audio/wav"}, _
{".wax", "audio/x-ms-wax"}, _
{".wbk", "application/msword"}, _
{".wbmp", "image/vnd.wap.wbmp"}, _
{".wcm", "application/vnd.ms-works"}, _
{".wdb", "application/vnd.ms-works"}, _
{".wdp", "image/vnd.ms-photo"}, _
{".webarchive", "application/x-safari-webarchive"}, _
{".webtest", "application/xml"}, _
{".wiq", "application/xml"}, _
{".wiz", "application/msword"}, _
{".wks", "application/vnd.ms-works"}, _
{".WLMP", "application/wlmoviemaker"}, _
{".wlpginstall", "application/x-wlpg-detect"}, _
{".wlpginstall3", "application/x-wlpg3-detect"}, _
{".wm", "video/x-ms-wm"}, _
{".wma", "audio/x-ms-wma"}, _
{".wmd", "application/x-ms-wmd"}, _
{".wmf", "application/x-msmetafile"}, _
{".wml", "text/vnd.wap.wml"}, _
{".wmlc", "application/vnd.wap.wmlc"}, _
{".wmls", "text/vnd.wap.wmlscript"}, _
{".wmlsc", "application/vnd.wap.wmlscriptc"}, _
{".wmp", "video/x-ms-wmp"}, _
{".wmv", "video/x-ms-wmv"}, _
{".wmx", "video/x-ms-wmx"}, _
{".wmz", "application/x-ms-wmz"}, _
{".wpl", "application/vnd.ms-wpl"}, _
{".wps", "application/vnd.ms-works"}, _
{".wri", "application/x-mswrite"}, _
{".wrl", "x-world/x-vrml"}, _
{".wrz", "x-world/x-vrml"}, _
{".wsc", "text/scriptlet"}, _
{".wsdl", "text/xml"}, _
{".wvx", "video/x-ms-wvx"}, _
{".x", "application/directx"}, _
{".xaf", "x-world/x-vrml"}, _
{".xaml", "application/xaml+xml"}, _
{".xap", "application/x-silverlight-app"}, _
{".xbap", "application/x-ms-xbap"}, _
{".xbm", "image/x-xbitmap"}, _
{".xdr", "text/plain"}, _
{".xht", "application/xhtml+xml"}, _
{".xhtml", "application/xhtml+xml"}, _
{".xla", "application/vnd.ms-excel"}, _
{".xlam", "application/vnd.ms-excel.addin.macroEnabled.12"}, _
{".xlc", "application/vnd.ms-excel"}, _
{".xld", "application/vnd.ms-excel"}, _
{".xlk", "application/vnd.ms-excel"}, _
{".xll", "application/vnd.ms-excel"}, _
{".xlm", "application/vnd.ms-excel"}, _
{".xls", "application/vnd.ms-excel"}, _
{".xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12"}, _
{".xlsm", "application/vnd.ms-excel.sheet.macroEnabled.12"}, _
{".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}, _
{".xlt", "application/vnd.ms-excel"}, _
{".xltm", "application/vnd.ms-excel.template.macroEnabled.12"}, _
{".xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template"}, _
{".xlw", "application/vnd.ms-excel"}, _
{".xml", "text/xml"}, _
{".xmta", "application/xml"}, _
{".xof", "x-world/x-vrml"}, _
{".XOML", "text/plain"}, _
{".xpm", "image/x-xpixmap"}, _
{".xps", "application/vnd.ms-xpsdocument"}, _
{".xrm-ms", "text/xml"}, _
{".xsc", "application/xml"}, _
{".xsd", "text/xml"}, _
{".xsf", "text/xml"}, _
{".xsl", "text/xml"}, _
{".xslt", "text/xml"}, _
{".xsn", "application/octet-stream"}, _
{".xss", "application/xml"}, _
{".xtp", "application/octet-stream"}, _
{".xwd", "image/x-xwindowdump"}, _
{".z", "application/x-compress"}, _
{".zip", "application/x-zip-compressed"} _
}
Private Function GetMimeType(ByVal extension As String) As String
If extension Is Nothing Then
Throw New ArgumentNullException("extension")
End If
If Not extension.StartsWith(".") Then
extension = "." & extension
End If
Dim mime As String = Nothing
Return If(_mappings.TryGetValue(extension, mime), mime, "application/octet-stream")
End Function
#End Region