I am trying to use QgsVectorFileWriter to write a kml file from an active layer in QGIS, but cannot figure out how to define the KML Name element (called NameField in the QGIS save-as GUI) to correspond with a field in my shapefile, which is called "TYPE".
This code does not cause an error, but I cannot figure out how to define StringList to specify that the NameField column name is "Type":
QgsVectorFileWriter.writeAsVectorFormat(layer, kmlPointFile, "UTF-8", None, "KML", onlySelected = 0, datasourceOptions = StringList)