Custom SharePoint List View - can I put it in a function (WSP)?
Here is my situation:
I work in SharePoint 2007 Enterprise, I have a function that creates a list for me when I deploy and activate it. So far, my usual workflow has been to deploy the solution, activate it, and then open SharePoint Designer to customize the list.
My settings are usually pretty complex, but I'll keep things simple. In this case, let me say that I am editing AllItems.aspx
, converting the data view to XSLT data view, then adding one column of static text.
I have used several different tools (SPSource, VSeWSS, SharePoint Manager, OCDExportList, etc.) to retrieve my custom schema.xml
and all default views, but I have not yet been able to figure out where the code is for AllItems.aspx
now this is configured.
When I extract (using any of the above tools) AllItems.aspx
it is no different from the default. An element <View>
in schema.xml is reduced to a single line like:
<View DefaultView="TRUE"
MobileView="TRUE"
MobileDefaultView="TRUE"
Type="HTML"
FPModified="TRUE"
DisplayName="All Documents"
Url="Forms/AllItems.aspx"
Level="1"
ContentTypeID="0x" />
I'm really stuck here ... I have no idea what to do. Is it possible? It will save me a lot of time (and documentation) if I can include my settings in my function.
If there is any other information I am missing that helps, let me know ... thanks!
Latest results :
I've learned a little more in the last couple of hours. If I save the list as a list template, save the .stp file locally as a .cab file, I can extract its contents. One of the files is manifest.xml
, which contains schema.xml
, as well as several other sections.
One of these sections is the section <webparts>
for which there is <webpart>
. Each of these elements <webpart>
contains a very long string of characters ... I don't know what these characters represent.
The important thing is that I think any custom views should actually be web parts if deployed as part of a solution ... but I'm not sure.
source to share
I ran into a similar problem a while ago. I had to create a very customized view and had to ditch the ListFormWebPart entirely and created my own website for data visualization.
Typically, when setting up an aspx file in SPDesigner, all your changes will be in the aspx file itself. Open it in SPDesigner and you will see all the changes you made. When converted to an XSL data representation, the standard ListFormWebPart is replaced with a DataFormWebPart, which does not care about the tags <View>
specified in the schema.xml; Have a look at the aspx file itself for ListFormWebPart.
Why not do all the customizations you want on the list, save the list as a template (it will include the associated AllItems.aspx), and then use that template in your function to create your list? You can add extracolumn from code (if it is dynamic and cannot be included in the template) etc.
source to share
Yes, you can. Get the Sharepoint Manager Tool from Codeplex http://spm.codeplex.com/
Install it on a machine in your farm, it will allow you to view the farm through a tree view showing all the objects.
Make a list through the Sharepoint GUI, then navigate to it using SPM.
SPM will allow you to extract the generated MOSS / WSS xml that describes the list view (it appears in the left hand property grid), which you can then paste into your manifest. xml
source to share
I have a similar problem and have been doing this a lot. The dataview web part is one of the most powerful components in Sharepoint for me. Unfortunately I have to provide my solution as a .wsp package, which means I can't just create a site and use Designer on that site. I took two steps in that I used a constructor to create my dataview and I also edited the code of this dataview to replace ListID and Guids with ListName and the actual name of the list. This allows you to export and use on any page / site as long as the list name matches. I am also creating a web page document library in my solution and I believe I can add pages that have web pages to this library using the onet.xml file. I will try to get the results of this test as soon as I can.