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();