you have a mapping data table with two columns first column “filename” starting keyword(Example: Invoice), second column “documentname”, based on the file name find out what is document name using linq query dynamically and replace the name in the below query to get document type id.
doctype(string) = taxonomy.DocumentTypes.Where(function(x) x.Name.Equals(documentname)).Select(function(y) y.DocumentTypeId).firstordefault
Linq Query documentname= dt.asenumerable().where(function(x) filename.startswith(cstr(x(“filename”)))).select(function(y) cstr(y(“documentname”))).firstordefault