How to convert from Map (mxd) to KML files (C#)

Discussion created by sheyangzi on Jan 3, 2012
Latest reply on Apr 2, 2012 by jtkknelson
I need to add a function of conversion from Map (mxd) to KML to my project. It seems there is not much reference on the internet. I have gotten some sample codes here:
I converted the codes to C#. I did not have any problems when I compiled it. But I received an error when I ran the application:

Source: ESRI.ArcGIS.Geoprocessing

StackTrace: at ESRI.ArcGIS.Geoprocessing.GeoProcessorClass.Execute(String Name, IVariantArray ipValues, ITrackCancel pTrackCancel)
   at ESRI.ArcGIS.Geoprocessor.Geoprocessor.ExecuteInner(IGPProcess process, ITrackCancel trackCancel, IGeoProcessor igp, IVariantArray iva)
   at ESRI.ArcGIS.Geoprocessor.Geoprocessor.Execute(IGPProcess process, ITrackCancel trackCancel)

Message: Error HRESULT E_FAIL has been returned from a call to a COM component.

Please advise!