To do this you use the TrFile_GetIcon function. It can create icons in sizes varying from 16×16 to 1024×1024 pixels and even with double resolution for retina screens.
You can get the icon like this:
Today we released an updated version of Troi File Plug-in, our plug-in for manipulating external files and folders directly from FileMaker Pro. This is a maintenance update, which has a few bugfixes and improvements in the Search, GetDate and Metadata functions. Upgrading to version 8.0.1 is free for all users of version 8.0.
More info here: www.troi.com/software/fileplugin.html