How to Add Custom Field Type (in SPFieldType Enum) Programatically or any other way
string tmpFieldName= tmpSPList.Fields.Add(dic.Key, SPFieldType.Text, false);
var newField = tmpSPList.Fields.GetFieldByInternalName(tmpFieldName);
newField.SchemaXml = newField.SchemaXml.Replace("Text", "XAttachmentField");
newField.SetCustomProperty("SiteURL", theSiteUrl);
newField.SetCustomProperty("WebURL", theWebURL);
newField.Update();
Powered By D&J (URL:http://www.cnblogs.com/Areas/)