tags:

views:

791

answers:

2

I need to create a SharePoint feature that will create some content pages. I know how to create a ListInstance element for a Document Library, but how can I add web part pages to the list?

I have created some pages with the Web UI (_layouts/spcf.aspx), but how can I use them in my ListInstance? Is there a way to export this content and use it in my feature? Or is there a different way I should approach this?

+1  A: 

A while ago I did something similar but then with Publishing Pages. Using a Feature I was provisioning Publishing Pages to the Pages library. Although it's not exactly the case you've described it might give you some idea of how to approach it. I have described my findings on my blog @ http://blog.mastykarz.nl/provisioning-publishing-pages-features-declarative-markup/

Waldek Mastykarz - MOSS MVP
+1  A: 

I am afraid that you will not be able to do so using the ListInstance Feature, ListInstance will only allow you create a List based on the Existing List Template. But you can try create a new Schema for the list and You need to do that in the schema.xml of the List. At the end of the schema.xml file you will see a entry as below

<Forms>
  <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" />
</Forms>

This dictates the list of forms the List has. You need to add another form you can make another entry say for example

<Form Type="NewForm" Url="NewForm2.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />

You will get another page NewForm2.aspx, UI will be as per the File form.aspx that is present in the location C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\Pages, You can copy form.aspx and make changes to that and point the SetupPath url to the new file. In case if you want to create a new View page you can do so using the tag of the Schema.xml

Kusek
What I am trying to do is create "Web Part Pages" like you can do on the web UI's Create New Web Part Page page (_layouts/spcf.aspx). Is that what you mean by a "View page"? I have looked at the View Schema on MSDN (http://msdn.microsoft.com/en-us/library/ms439798.aspx) and don't think that is what I want.
Joosh21
Well I carried away by the Question "web part pages to the list?" , may be you should update the Question please. What I meant is that, by default there are few WebPart Pages that gets created when you create a List these pages reside in the Forms Folder of the List. By Seeing ListInstance I gave you the above answer, but ListInstance you mean in the question is not the same. Rephrase your question.
Kusek