Geoprocessing field mapping
GPFieldMapping\FieldMapping.cs
// Copyright 2010 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.
// 

using System;
using System.Collections.Generic;
using System.Text;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geoprocessing;
using ESRI.ArcGIS.Geoprocessor;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.ConversionTools;

namespace GPFieldMapping
{
    class FieldMapping
    {
        static void Main(string[] args)
        {
            // Initialize license
            ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);
            IAoInitialize aoi = new AoInitializeClass();
            aoi.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcInfo);

            // Initialize the Geoprocessor
            Geoprocessor GP = new Geoprocessor();
            
            // Create the GPUtilites object
            IGPUtilities gputilities = new GPUtilitiesClass();

            // Create a DETable data element object 
            IDETable inputTableA = (IDETable)gputilities.MakeDataElement(@"C:\gp\citiblocks.gdb\census", null, null); 

            // Create an array of input tables
            IArray inputtables = new ArrayClass();
            inputtables.Add(inputTableA);

            // Initialize the GPFieldMapping
            IGPFieldMapping fieldmapping = new GPFieldMappingClass();
            fieldmapping.Initialize(inputtables, null);
            
            // Create a new output field
            IFieldEdit trackidfield = new FieldClass();
            trackidfield.Name_2 = "TRACTID";
            trackidfield.Type_2 = esriFieldType.esriFieldTypeString;
            trackidfield.Length_2 = 50;

            // Create a new FieldMap
            IGPFieldMap trackid = new GPFieldMapClass();
            trackid.OutputField = trackidfield;

            // Find field map "STFID" containing the input field "STFID". Add input field to the new field map.
            int fieldmap_index = fieldmapping.FindFieldMap("STFID");
            IGPFieldMap stfid_fieldmap = fieldmapping.GetFieldMap(fieldmap_index);
            int field_index = stfid_fieldmap.FindInputField(inputTableA, "STFID");
            IField inputField = stfid_fieldmap.GetField(field_index);
            trackid.AddInputField(inputTableA, inputField, 5, 10);

            // Add the new field map to the field mapping
            fieldmapping.AddFieldMap(trackid);

            // Execute Table to Table tool using the FieldMapping
            TableToTable tblTotbl = new TableToTable();
            tblTotbl.in_rows = inputTableA;
            tblTotbl.out_path = @"C:\gp\citiblocks.gdb"; 
            tblTotbl.out_name = "CensusVista";
            tblTotbl.field_mapping = fieldmapping;

            GP.Execute(tblTotbl, null);
        }
    }
}