SharePoint 2010/2007 - Possible to change site definition for existing site? - sharepoint

We have started our effort to migrate to 2010 from 2007 SharePoint.
In 2007 we used a site definition. After the migration, it is obvious we have work to do on our 2007 site definition.
1.) What is the best path for us?
2.) Can we create a new Site Definition in 2010 and change the site definition that existing sites used to the new one?
thx

After you do the migration, you can export the site definition of a migrated site as a template and use it as your site template for new sites.
To change the definition of existing sites, you need to write code that loops through the sites and updates them. If you have very few you could do it manually.

Related

How to create a sharepoint 2010 template that will dynamically update its child sites

I recently created a site in Sharepoint 2010, and I have saved it as a template. I'm able to apply this template to new sites, which is great. I can then add new data to each site individually. However, my problem is that if I want to change something on every child site, I would have to go through manually and do so. Is there any way that I can create a template that will work dynamically so that I can make changes to the original and all the child sites will inherit these changes?
Unfortunately not how you are requesting. When a site is created it uses a site template, including your own custom site template. Once a site has been created there is no way to reapply a site template to that existing site. You could use PowerShell to update a series of existing sites but the commands would get quite complex.
If you have deployed new site collections using a globally deployed template and you change that template using SharePoint designer, you should not have any issues and changes will be automatically applied to child sites unless you change master page.

Setting up default web parts on a Wiki Page from a Web Template in SharePoint 2010?

My team is trying to build out a Web Template which includes an instantiated Wiki Page with some default Web Parts added to it; but we're unable to get this behavior to happen.
In brief, we're looking to add some default.aspx (or Home.aspx, the name is unimportant, just the functionality) to the SitePages directory, GhostableInLibrary; so it's visible to all SiteCollections made from this Web Template.
It is of note that we're basing our Web Collection off the Team Site, and that the Wiki will be the default Home Page for the new site.
Site templates can be used to customize newly created sites except for the top site of a site collection. Since site templates are all managed in site collection's Solution gallary, so a site template CAN'T be used to define its own container.
You need a Site Definition to customize the first site of your site collection.
For how to use site template, you can goto, http://weblogs.asp.net/soever/archive/2009/10/19/sharepoint-2010-site-exporting-as-wsp-solution-part-1.aspx
For how to create a site definition, you can goto, http://msdn.microsoft.com/en-us/library/gg276356.aspx
If you want to strap onto an existing template without creating a new copy, or you don't have the original site template to access. You use a process called feature stapling.
When you create a sharepoint solution it would contain two features, one for your actual functionality and one that simple staples it to an existing template.
Here is an article discussing it some more. http://mssharepointtips.com/tip.asp?id=1065

Building sites besides sharepoint site template

During site creation using SharePoint, SharePoint offers some templates. If we need to create a site other than a template offered, how should we proceed?
You have 2 options:
Site Templates
Site Definitions
Many people use those terms interchangeably, but there are big differences between the two.
Site Templates
Site templates are easy to create. Basically, you create a site using a ite definition (e.g. the blank site) and start customizing it. You can add lists and libraries and setup the site however you want it. Then, go to Site Actions > Site Settings > Save site as template. You can save your site as a .STP file. The .STP file basically records everything that you added or changed on your site after site creation.
Once saved, your site template will show up in your site template gallery. You can go to the site template gallery and save the .STP file offline. Your new site template will be available in the subsite creation page in the "custom" tab. The template will only be availalbe in this site collection, unless you add the .STP file to the site template gallery of another site.
You can deploy site templates globally. So, if you want everyone to see a STP in their subsite creation page, you can run the following stsadm command:
stsadm -o addtemplate -filename BoardDirectors.stp -title "Board of Directors"
You can retract site templates whenever you want without affecting the sites that used them for creation. This makes them easy to version, as long as you don't want to push updates to existing sites.
One big problem with site templates is that you cannot staple features to them.
Site Definitions
Site definitions are collections of XML files deployed to the 12 hive. They are harder to develop; you basically have to use Visual Studio. The XML files have to be packaged into a SharePoint WSP and deployed using STSADM.
Creating a site definition gives you the most control over your site. Another benefit is that sites using the site definition will always reference the site definition's files, so updates will be recognized by sites using that site definition. For example, if you find a bug, you can fix it in one spot and all sites using that site definition will be fixed.
Note that withdrawing a site definition will break sites that use it.
Recently, many SharePoint experts have recommended staying away from creation new site definitions because of the overhead. Instead, if custom functionality is needed, they recommend coding custom features and just activating those features on sites.
Think about which option you need. In our organization, we chose not to create any new site definitions, and use site templates sparingly. Custom functionality is driven primarily by the use of features.
You are talking about custom "site definitions" and custom "site templates". Google those terms and you'll find tons of information.
You can design your own custom templates. Install VSeWSS extension for Visual Studio and it has a project type called "Blank Site" template. You can use it as a base starting point and customize the solution generated to your needs. All the information required to do so is available in the help document that comes with VSeWSS.

Sharepoint 2007 template to site definition conversion

Is there a way to (semi) automatically convert a sharepoint 2007 site template to a site definition? This seems like it could be quicker than building a site definition from scratch, yet provide the benefits of the site definition.
I think with VSeWSS 1.2 you can convert a site to an site definition.
Extract from the VSeWSS 1.2 announcement on the SharePoint Team blog:
SharePoint Solution Generator
This
stand-alone program generates a Site
Definition project from an existing
SharePoint site. The program enables
developers to use the browser and
Microsoft Office SharePoint Designer
to customize the content of their
sites before creating code by using
Visual Studio.
So crating a site from a site template an then running VSeWSS 1.2 should do the trick.
One way you can do it to rename the Site Template (.stp) file to .cab and extract the content and get the onet.xml schema and customize it as you wanted it.
Which defintion was used for the site template do you want to convert? I've found the SharePoint Solution Generator to be hit and miss. For example I can't get it to process blog sites. Worth a shot though.

SharePoint 2007 Site Template Content Types

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

Resources