Sharepoint Site Template - Activate dependent features on provisioning - sharepoint

I wish to define a Sharepoint site template that will also include a web part dependent feature. How can I install and activate the web part feature when I provision a site using my custom template?

You can't install a feature when provisioning a site you can only activate it
If your developing a Site Template then you can activate the feature by activating it inside the site you use to create your site template before you save it as a template.
But if this is something that's going to be reused I recommend that you develop a Site Definition instead and in here you can specify which feature to activate both at Site Collection and Site level. You can then package your feature and site definition into the same Solution package then the feature will always be installed when referenced by the Site definition

Related

Unable to create sharepoint site from migrated site template(.wsp)

I have subsite (sharepoint2010) which consist of some custom feature and which has been migrated from sharepoint 2007, I save this site as a site template (in dev environment), when I try to create a site base on that site template in production (it is havig all the updated solution) it was not able to create the site,I check the log and found the following error:
No document templates uploaded for list "$Resources:core,MasterPageGallery;" -- none
found for list template "100"
The logs are written below against the correlation ID
and Failed to apply template "STS#1" to web at URL
Failed to activate site-scoped features for template 'STS#1' in site
0x1A7C SharePoint Foundation Feature Infrastructure 889y High The element of type
'Module' for feature '1324A_Test_NLModules' (id: cd6559bc-d107-4609-baa2-c0582c63351b)
threw an exception during activation:
System.Runtime.InteropServices.COMException (0x80020009):
where '1324A_Test_NL the name of the template.
Although I can create site based on the same template on my development environment.
I have already activated the the PublishingInfrastructure feature, in my site collection features gallery and deleted unnecessary document from one of the document library in the site. Can anyone suggest what will be the resolution?

How to Deploy a Custom WebPartPage to a specific target site (Web)

I have created a custom web part, let's call is AppPart, and a custom web part page, let's call it AppPage, in the same solution. I changed the AppPage's Elements.xml so that it automatically contains the AppPart when the Feature is activated. This works excellent for my purposes. My problem is that Visual Studio will only allow me deploy the feature to a Site (site collection) scope and I need to deploy this page to a Web (specific web site) scope. From my understanding, this is possible to do but a configuration change has to be made by hand.
using powershell, specify the web application in the command.
Install-SPSolution -Identity <SolutionName> -WebApplication <URLname>
take a look at this link & do a ctrl+F for "To deploy a solution package to a single Web application by using Windows PowerShell"
http://technet.microsoft.com/en-us/library/cc262995(v=office.14).aspx

How to force users to use specific custom template for meeting workspaces?

I have a calendar on a SharePoint 2010 site and I have created a custom site template based on the standard meeting workspace. I'd like to force users to only be able to use my custom template.
One option is to add Hidden="TRUE" in webtemp.xml for all other meeting workspace templates - this will leave mine as the only option. This, however, works on the farm level and I'd like to keep the templates available for other web applications. If I can do this on a web application or lower level it will do the trick.
Even better solution - if I can make the new event dialogue skip the step altogether and use my template without asking.
Background:
My custom template only contains security customizations, no UI or content changes. I want to impose it as I have requirements for the permissions of the meeting workspaces which are different from the parent site - so inheritance has to be broken. But I can't think of another way to supply default permissions other than by using a site template for the workspace.
Site Settings > Look and Feel > Page Layouts and Site Templates
choose the site templates you want to be used in the site, this can inherit all the way down the site collection or you can start in a subweb.

Enabling publishing infrastructure feature by default in sharepoint 2010?

I know how to in the settings activate publishing feature on a site but is it possible to have this by default when a new site is created from the UI?
I have some customized stylesheets and when a new team site is created it doesn't load these but instead looks like a sharepoint site out of the box. When I go to settings and activate publishing features the page reloads with the custom stylesheets. I wish to not have to do this every time a new site is created. Is there a solution to this?
Thanks in advance.
I guess you could either:
Build a site template (can't remember if these store feature activations)
Build a custom site definition, and activate the features you need
Build a stapling feature to tie your feature to the site definition

Creating Site Templates from MOSS publishing sites

I know that creating a site template from a MOSS publishing site is not currently supported by Microsoft.
Can anyone tell me if creating a basic site, then turning on the publishing feature, then creating a site template is supported - I would guess not as it's probably the same as creating a publishing portal?
You can staple the publishing feature onto your site template.
From KB 986908:
You can create a stapling feature to staple the Office SharePoint Server Publishing feature to specific site templates. For example, see the Feature.xml file in the "Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Template\Features\PublishingStapling" folder. To staple the Office SharePoint Server Publishing feature to all site templates, use the TemplateName="GLOBAL" property. This property staples a particular feature to a site definition if the site definition does not specify the AllowGlobalFeatureAssociations property. (Only the Shared Services Provider site template and the Blank Site site template use the AllowGlobalFeatureAssociations="FALSE" property.)
For example, when you use the TemplateName="GLOBAL" property to staple the Office SharePoint Server Publishing feature, a site that is based on the Team site template uses the system master page that is configured for the root site of the site collection.
you can still access the save template webpage, and save it...
for example http://localhost/website/_layouts/savetmpl.aspx
and it works like a charm :-)
I don't think what you're describing will work (like you said, it's basically the same thing as a Publishing Portal), but there appears to be a workaround. According to this post from the SharePoint Solutions Team (apparently not related to Microsoft), you can create a publishing site, customize it as needed, deactivate the publishing feature, create a site template from it, create a new site based on the template, and then activate the publishing feature on your new site.
It sounds like this works, but is not officially supported by Microsoft. Be careful, since it may mostly work, but I wouldn't be surprised if some small pieces of it break.
We wrote our own tooling to solve the export problem. We can create site columns, content types, master pages, page layouts etc in the Publishing site, and export selected items to a WSP package for deployment to other servers.
The tool SPSource takes a similar approach, but creates a Visual Studio solution for compilation. The result can be packaged with WSPBuilder.

Resources