尝试一下。 我认为您不需要 XML。 您只需要使用字符串收藏来添加列 。
using (SPWeb web = properties.Feature.Parent as SPWeb)
{
System.Diagnostics.Debug.WriteLine("Creating the list");
//web.AllowUnsafeUpdates = true; //use this in an application page no need in a dll
web.Lists.Add("Customers", "Store informations about my Company Customers", SPListTemplateType.GenericList);
web.Update();
System.Diagnostics.Debug.WriteLine("Creating the Fields");
SPList myNewList = web.Lists["Customers"];
myNewList.Fields.Add("First Name", SPFieldType.Text, false);
myNewList.Fields.Add("Last Name", SPFieldType.Text, false);
myNewList.Fields.Add("Adress", SPFieldType.Text, false);
myNewList.Fields.Add("City", SPFieldType.Text, false);
myNewList.Fields.Add("Latest Purchase Date", SPFieldType.DateTime, false);
myNewList.Fields.Add("Sales Comments", SPFieldType.Note, false);
myNewList.Update();
System.Diagnostics.Debug.WriteLine("Creating the view");
System.Collections.Specialized.StringCollection strColl = new System.Collections.Specialized.StringCollection();
strColl.Add("Title");
strColl.Add("First Name");
strColl.Add("Last Name");
strColl.Add("Adress");
strColl.Add("City");
strColl.Add("Latest Purchase Date");
strColl.Add("Sales Comments");
myNewList.Views.Add("Summary", strColl, @"", 100, true, true, Microsoft.SharePoint.SPViewCollection.SPViewType.Html, false);
myNewList.Update();
}