Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Background: (tool used Sharepoint designer 2007) 1. I created a aspx page (using UI) that is inside a document library (content type is web part pages and a custom content type). 2. I then added 3 web parts (2 simple list. 1 current document library list) to this page

===========================================================================

  1. Now I need the same aspx page with 3 webparts for all the other document libraries I have on the same sub site.
  2. I need to create 100+ same aspx pages for 100+ document libraries.
  3. The aspx pages are named after the document libraries. For example, TestDocLib document library will have TestDocLib.aspx in it. (I have a text file with all the document libraries names)

===========================================================================

  1. Do I need to create a console app for this? or feature ... I really need some suggestions.
share|improve this question
add comment

2 Answers 2

You could easily turn this into a feature with a Module. Add each web part page into a File element and your Web Parts into a AllUsersWebPart element and then activate the feature on your web sites, like this:

<File Path="default.aspx" Url="Documents/default.aspx" 
   Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE">
  <AllUsersWebPart WebPartZoneID="Main" WebPartOrder="0" ID="WebPart1">
        <![CDATA[
        <webParts>
        <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
        <metaData>
        <type name="**Full class/assembly name**" />
        <importErrorMessage>Cannot import this Web Part.
        </importErrorMessage>
        </metaData>
        <data>
        <properties>
        <property name="Title" type="string">The title</property>
        ...
        </properties>
        </data>
        </webPart>
        </webParts>
       ]]>
 </AllUsersWebPart>
  </File>
</Module>
share|improve this answer
add comment

First of all is the parent site a Collaboration or Publishing site? Because there are different options available to you if it is a publishing site.

If the parent site is just a standard Team Site then you could do something like this to programmatically create a page in a document library -

[http://stackoverflow.com/questions/979635/programmatically-instantiate-a-web-part-page-in-sharepoint][1]

Then once you have created the page you can get a reference the SPWebPartManager class to add the web parts to the page.

I would suggest either doing this in a console app or perhaps a custom SharePoint timer job that you can execute manually.

Hope this helps,

Cheers

Alex

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.