This worked (mostly):
But: in SP Here at my client’s office, I had to muck about with the Target location (step 6) for the Schema.xml file. I ended up setting it to the name of the visual studio project, not the name of the list contained there-in. Also in step 6, file I edited was SharePointProjectItem.spdata, not SharePointItem.data.
Finally, I had to rename the .stp to a .cab not a .zip before I could open the manifest.
In case the link above ever breaks (and also so I have the instructions handy for myself in future), here’s the content of it, replicated for posterity. Credit is hereby given to the original author, Saurabh Khatri, for a great time saving idea.
Assumtions: I am assuming that we have already created SharePoint Project in Visual Studio 2010.
Preparing Solution Structure
1. In your visual studio instance, Right Click on your sharepoint project and click on Add > New Item.
2. From the Wizard, choose the SharePoint List Instance.
3. a) Give some name your List Instance(Display Name), I will give this ‘MyNewCustomList’
b) Choose a List Template, You can choose any List Template, and choose a List Instance, Let me choose Custom List to keep it simple.
c) Give List a URL, “Lists\MyNewCustomList”
d) Click ok to close the wizard.
4. After step 3, we will be having a SharePointItem ‘MyNewCustomList’ of type List Instance with a element.xml file, instantiating it from TemplateType=100, that will create a custom list with a Title Column in it. But we wanted to add the fields to this custom schema.(In SharePoint 2010 we can create a List Instance without creating a ListTemplate by specifying CustomSchema property for ListInstance. http://msdn.microsoft.com/en-us/library/ms476062.aspx
<ListInstance Title=”MyNewCustomList” OnQuickLaunch=”TRUE” TemplateType=”100″ Url=”Lists/MyNewCustomList” Description=”My List Instance” CustomSchema=”MyNewCustomList\Schema.xml” />
5. Now Lets Add a Schema.xml File to your SharePointItem.
6. Also include this file into your SharePointItem.data file.
This is how we do it. Click on the your ‘MyNewCustomList’ in Solution Explorer in Visual Studio. Right click Open Folder in Windows Explorer. Open SharePointItem.Data in notepad
<ProjectItemFile Source=”Schema.xml” Target=”MyNewCustomList\” Type=”ElementFile” />
We are done with Solution Preparation steps.
We will now create a Custom List in SharePoint with ”MyNewCustomList”. Go to List Settings and Add the columns, as per the requirement. After doing with all changes whether it is a addition of List Column, Creating a View, addition of some content Type etc.
1. Save this list as Template. Go to Template Gallery, and Download your list template. This file will be a .stp file.\
2. Change the File Extenstion to .zip.
3. Open the zip file, it will contain a manifest.xml
4. Open Manifest.xml file in some nice editor like notepad++.
5. Carefully, Locate node “<List>” in this xml. Copy this entire section of <List>…</List> and now paste it in your schema.xml file we created in above steps.
Few Final Modifications and we are done in Schema.xml file.
1. Remove the name attribute containing List GUID of your previous List.
<List Name=”SomeGUid” …> remove this Name attribute, we don’t need this in our schema
2.Replace the following nodes <View>
<View BaseViewID=”1″ Type=”HTML” Level=”1″ ContentTypeID=”0x” WebPartZoneID=”Main” OrderedView=”TRUE” DisplayName=”All Links” DefaultView=”TRUE” MobileView=”TRUE” MobileDefaultView=”TRUE” SetupPath=”pages\viewpage.aspx” ImageUrl=”/_layouts/images/links.png” Url=”AllItems.aspx”>
Also replace the Forms Node with the below one.
<Form Type=”DisplayForm” Url=”DispForm.aspx” SetupPath=”pages\form.aspx” WebPartZoneID=”Main” />
<Form Type=”EditForm” Url=”EditForm.aspx” SetupPath=”pages\form.aspx” WebPartZoneID=”Main” />
<Form Type=”NewForm” Url=”NewForm.aspx” SetupPath=”pages\form.aspx” WebPartZoneID=”Main” />
Great we are done, Now we can include this ListInstance in a feature and create a package. Activating that feature will create a ListInstance.
The first client I used this technique at was on SharePoint 2010. It worked as well for me in SharePoint 2013 at the next client as well.