SharePoint 2007 Site Template Content Types - sharepoint

I am new to SharePoint development. We have created a base site template and have used that template to start new sites in other locations on the same server. This works fine but the newly created site seems to "flatten" the custom content types created in the original site. I would think there would be a way to keep the original content type inheritance intact to help support any necessary modifications on the new site. They can still make the modifications but they take longer because you have to visit each list individually. Does anyone know how to fix this or know a better way to approach this?

The problem you are having is the move from your original site collection to another. The site template does not store the complete definition of a site - only the differences from the underlying site definition. Move from one site collection to another and you lose the underlying site definition and run into problems such as the loss of your content types.
Site templates and site definitions are two separate customizations you can undertake. You need to make a decision based on your requirements as to which is best.
Site templates
Pro's:
Easy to create and reuse through the SharePoint interface
Ideal for end users
A site template is a customization of the underlying default site definition
Con's:
Dependency on underlying site definition means SharePoint updates could break your site templates
Poor performance since the modifications are held in the database and are read from the DB and compiled on each request
Limited customization options
Site definitions
Pro's:
Harder to create: involves coding XML
Made by developers and site administrators
Independent of SharePoint default site definitions so not affected by SharePoint updates
Limitless customization options
Con's:
Difficult to modify when deployed
Can be cached on the file system so is fast to load
Check out Google for info on creating custom site definitions.
Hope this helps!
Jonny

The best way to do this is to create a site definition where the content types are within features whose scope is to the farm.
Tim

Related

SharePoint 2010 Solution

I'm creating a Site Definition for SharePoint 2010 using VS 2010. Have some questions:
How do I limit the page layouts to the custom ones that I created?
I created a custom Home Page layout. How do I by default create a page based on this page layout and set it as the welcome page for the site?
Your implementation approach (either declarative or programmatic) isn't indicated in your question so I am only assuming that you are building your custom site definition declaratively (with CAML). You will find that creating a custom site definition declaratively is pretty painful, especially when debugging. It usually involves making changes to the onet.xml file and just hoping things go right during deployment and/or site creation.
When developing custom site definitions, I find it easier to forgo the declarative mess and staple a custom feature to my custom site definition, allowing me to build the site up with code. Andrew Connell has a blog post to this effect:
http://www.andrewconnell.com/blog/archive/2008/02/15/You-dont-need-to-create-site-definitions.aspx
(Disclaimer: yeah, it's old, but still quite relevant, in my opinion)
Now that your tasks are programmatic (allowing you to debug, log errors, and generally have more visibility into the SharePoint magic) you can initialize your new SPWeb object as you see fit via the SharePoint object model.
Setting the available page layouts.
Setting your custom page as the homepage (after you add it to the Pages library).
Perhaps someone else can enumerate 100% declarative approach; I'm sure it's ugly, as is most CAML.

Is it a good idea to use content deployment in SharePoint as a solution for content roll up?

We use SharePoint 2007 and have set up a web application with several site collections. One for each of our clients. We'd like to synchronize content in all of the site collections. Maybe having a central repository, then all other site collections get content from here.
I was looking at Lightning Tools Conductor web part and seems a pretty good solution. However, I'm wondering if this can also be possible using the Content Deployment feature to copy a site from the central repository to all other site collections.
I do not advice you to copy and thus duplicate the information from your central repository to the other site collections. You'll lose precious disk space, performance and scalability.
If you have content that is created in a common site collection, you should either use the built-in web services or create dedicated ones to retrieve the content within the targeted site collections.
I usually create cross site collection look-up fields that allows a contributor to pick an entity from my central repository in a visual way and apply the rendering of the content once the page is in view mode.
That might not suit every need but I don't think content duplication is a wiser choice.
Edit : re-reading your question, is there a specific reason why you want to copy a complete site (spweb I guess) rather than specific content inside ?

Update base template and apply to all sites who reference it - MOSS 2007

More SharePoint questions from me again today! I thank everyone that has helped thus far!
Here is my situation:
I have to create a custom application inside of sharepoint. I am using a document library which hosts web part pages and i am using Web User Controls to do all the manipluating and displaying of data. Once I build the app the way i want, I am going to turn the doc lib into a template that way i can create the same thing on multiple sites (many customers using this app).
The issue that I am running into is that I need to know what happens/how do I update it so that my changes will apply itself to all sites that are referencing the template.
HELP! anyone who knows how to do this OR has a better idea for creating custom apps that multiple sites will be able to take advantage of would be SO helpful!
Thanks
Short answer is that you cannot accomplish this, even with a custom site/list definition.
Once a site or list is created from a site or list definition, it is basically on its own (layouts and master pages modifications, however, do get applied to all sites referencing them).
Once workaround would be to create a site feature that iterates through sites and performs whatever custom action you wish to do.
For requirement like this, you really should create custom list/site definition. NOT just save customized list into template.
Anything you have updated in list/site definition will be reflect to the sites that are referencing the definitions. Unfortunately this is not the case for Template. You will have to delete the old list you have on other sites, then re-create them again with new template.
how to create list definition - http://msdn.microsoft.com/en-us/library/ms466023.aspx
for site definition please go - http://technet.microsoft.com/en-us/library/cc287930.aspx
James

Sharepoint: Modify the page template of views

I have a sharepoint list with several views. I can modify the view pages (such as AllItems.aspx) via the sharepoint designer. However I would prefer to modify the underlying template instead.
Now I could directly modify the default view page template located in templates\pages\viewpage.aspx but this would affect the whole sharepoint installation.
I would rather make a copy of this template and make my list (or views) point to it. Is there a way I can accomplish this?
Note: The list/views were created via the Web UI without any custom XML.
Check out this blog:
http://weblogs.asp.net/soever/archive/2006/11/11/SharePoint-Solution-Generator-2D00-part-1_3A00_-create-a-site-definition-from-an-existing-site.aspx
Basically, use the sharepoint solution generator to create a VS solution of your SharePoint list. The solution will contain a file called schema.xml that defines the list and associated views. You can then customize the aspx pages like viewlist.aspx and point the schema at your custom pages. When you deploy the solution/feature it will deploy your custom pages with it.
There's really a wealth of info out on the internets, it's just difficult to find when you don't know what you're looking for. But this should get you started in the right direction.
Also, in my experience, once you create the solution you should port it (read: copy teh contents) into an STSDEV project. STSDEV really shows you what's happening behind the scenes, whereas the other VS tools for SP development can do some hand-waving magic which will leave you in the dark when things go wrong. Just my 2 cents.

How to deploy Sharepoint publishing site with multiple sites

I am developing publishing site and it will have complex tree structure.
Is there any way to deploy site structure (multiple sub sites - SPWeb) using SharePoint solution?
I know I can create site tree programmatically.
I have been on a project with the same needs, but we didn't find the answer with the OOTB functionality of the feature framework. We also had to go through the object model and do the creation programmatically.
But instead of hard-coding the site structure, we took a different approach. Our solution was to implement a generic SiteCreation feature that takes an xml file as input. The xml defines the site structure and is read by the feature receiver which parses it and creates the specified sites.
I know that there is some coding involved in this solution, but I think the extra work is well spent, since the site structure will likely change numerous times before it reaches production.
The default publishing portal (and collaboration portal) site definitions use a portal provisioning class to build the site structure based on an xml file (this is all out of the box for a MOSS installation).
You can see how the provisioning class is referenced in the webtemp file for the portal site definitions (12\TEMPLATE\1033\XML\webtempsps.xml). An example of the actual xml documents that are used can be found in 12\TEMPLATES\SiteTemplates\WebManifest - it's a fairly straight forward schema.
If you are creating a custom site definition based on publishing portal then you can re-use the provisioning class and provide your own xml document to build your custom site structure.

Resources