I am a .net developer and want to learn SharePoint. Usualy we use MasterPages to have a constant layout for all or some of the pages. My confusion here is SharePoint uses Site Template and MasterPages which both sounds to do same thing. am I right?
thanks
MasterPages and Site templates are absolutelly different thing. Master page is usually layout of some pages. It's same like in ASP.NET.
In Sharepoint you can create some sites in site collection. These sites are created according to site template. When you creating (for example) team site, it's created according to team site template, which is stored in Sharepoint folder on file system. In site templates you can specify which features should be activated when site is created, which features should be activated on site collection scope etc. Also you can specify list, which should be created, modules... And also you can specify default master page which will be used on site.
You can find more informations on msdn
Related
I want to create my first SharePoint App. I am wondering, is it possible to create an app which will create SharePoint site and will build a structure (with a few lists and libraries) on this site?
Yes is possible. It depends what are your business requirements. I mean based on what rules you want to create the site (SPWeb)? Most likely you would need to create a WebPart (which is similar to a UserControl ASCX in ASP.NET) and put there the interaction with user. Then, if the sites to be created has usually the same lists and libraries and so on I would suggest you to create a Web template which contains these things and then simply create a Site based on that web template...
I can provide you some further examples if you want...
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.
What is the main differences between site definition and site template?
A site definition is the basic blueprint for a site, including how it looks, what lists it contains, default navigational structures, and so on. You normally create a site definition by hand-editing CAML.
A site template can be created from within the Sharepoint application, and is basically a "diff" between the site definition and any changes made since the site was created. A site template is based on the underlying site definition, which means that if you create a new site from a template, and later change the underlying site definition, you run the very real risk of irreversibly screwing up your site.
A best practice is to configure a minimal site definition that, once created, is never modified again, and use site templates to store reusable customizations.
Feature Stapling
Site Definition: Supported
Site Template: Not supported
Multiple webs
Site Definition: Can provision multiple webs.
Site Template: Can only provision one web.
Complexity
Site Definition: Complex to create
Site Template: Easier to create
Permissions
Site Definition: Requires admin access to server for deploying.
Site Template: Installable from a Web UI by site owners.
Performance
Site Definition: Files are on disk, better performance.
Site Template: Files are in database, less efficient.
There are lots of main differences. Depends on what you are looking for:
Deciding Between Custom Web Templates and Custom Site Definitions:
http://msdn.microsoft.com/en-us/library/aa979683.aspx
I am creating a site template in Sharepoint. I also have some custom .aspx page, that I want to deploy in Layouts\myDirectory. Using my site template I will create a Web (SPWeb) that should use the custom pages and reference them by an url of the form http://site/MyWeb/MyCustomPage.aspx. How do I integrate the pages in my custom template?
Pages stored in the Layouts folder are Application Pages and should always only be referenced through the _layouts virtual directory
If you want to reference the page as http://site/MyWeb/MyCustomPage.aspx then it should be a Site Page
A site page can be put inside a feature or directly inside a Site Definition (even thought I recommend that you only use the Site Definition to activate features). The way you provision the page is throught the Module & File elements see MSDN
A site template can only contain the contents of a single site/web. So you can't deploy files to the layouts folder using this technique.
However you can use site templates in combination with a solution package that copies your files. There is an example here. Deployment of the solution package will deploy your custom .aspx pages once. From then on they will be accessible to sites created by your site template.
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.