How to create sharepoint 2010 site programmatically based on site template - templates

I am new to SharePoint my requirement is, we are developing a business intelligence dash board using pps with some custom reports built on it.
I need to replicate this site to create n no of subsites based on this bi dash board site. So I am planning to make this site as a site template and trying to create the site programmatically based on this site template. Can anyone help me how to achieve this.
Waiting for your reply.

One of the overload of creating a site accepts a site template object. What you need to do is to retrieve this object iterating through the collection of the custom web templates of the site collection: SPSite.GetCustomWebTemplates. You just get the one you need by name

Related

Bulk Creation Of Items In Sitecore

I am using Sitecore 8, Update 3.
I am attempting to bulk create a couple thousand items that use a custom template. All of these items are created under one specific parent item.
The custom template has two fields which are Path [Single-Line Text] and Target [General Link].
The source of the data is in an old SQL database.
Is there a way to do this?
The Sitecore marketplace module Data Importer is a option for you.
Create a custom importer with the sitecore api is also possible, to speed up, you can disable the index rebuild.
Since your data is already in SQL Serve, you should take a look at using the SSIS Components for Sitecore, it was designed for importing exactly this kind of data in bulk into Sitecore using ETL.
You can find more info in the blog post Creating your first project with SSIS Components for Sitecore and there is also some good additional into in the Migrating to Sitecore: Going from WordPress to Sitecore with SQL Server Integration Services (SSIS) post.
The Integration Services Components for Sitecore is available on the Sitecore Marketplace, and it is compatible with Sitecore XP8.
I'll also add, if you are creating anything more than 100 items below a single parent item then this is not recommended Sitecore practice unless the items sit within an Item Bucket. Make sure you account for this, or split your items up into smaller sub-folders (e.g. year/month folders for news article type items)
In these scenarios you normally end up writing code to call the api and create the items programmatically rather than doing a generic import.
If you need to create a large amount of items I would recommend writing a console app to do this. You could use the Sitecore Item Web api to create items outside of the Sitecore context or investigate the new Entity Service api in Sitecore, both will be capable of creating large amounts of Sitecore items.
http://mikerobbins.co.uk/2015/01/06/entityservice-sitecore-service-client/
https://sdn.sitecore.net/upload/sdn5/modules/sitecore%20item%20web%20api/sitecore_item_web_api_developer_guide_sc65-66-usletter.pdf
If these don't float your boat you could always write async code to create the Sitecore items and have that executed by an aspx page in a Sitecore instance - works well for one off tasks.
Example of Asynchronous page processing in ASP.net webforms (.NET 2.0)

Autocomplete field in Web Forms for Marketers and custom Field validator

I am using WFFM in Sitecore 7.1 , one of the requirement to have a field named Countries and want to use it as autocomplete field.
I have already loaded all the Countries in Sitecore as Sitecore Object.
I was following the Custom Credit card field , but it didn't help much.
I created custom autocomplete Field in WFFM and now i want to create custom validation for this field .
Any help..
Thanks
To keep it simple you might want to consider a custom control like credit card and use client side JS to call your countries via sitecore web API and then do all the auto complete stuff in the js leaving all logic there.
If server side code is a preference then u can write a web service to return you the JSON objects of matching countries making your JS more simpler.
Hope this can help with some ideas.

Can Velocity or Freemarker template be used for VIEW of Custom plugin portlet?

I am trying to have a custom plugin portlet in liferay for which I can customize the view page with velocity or free-marker template like we have for Asset Publisher in Liferay 6.2.
Requirement
I have a screen for admin (CRUD) through which data would be added in my custom tables through this portlet and then there is a VIEW page for all other users.
Now this portlet can be deployed on different sites or different pages with page-scope and the requirement is that it should have a different look & feel for different pages. Currently we are handling this scenario through deploying different themes to configure the look & Feel of the portlet, but we also need some layout changes which is a limitation with themes.
So I was thinking if we can utilize something similar to a velocity template for the View page but I am not sure where to start and whether liferay provides some easy way to do this. So that we create a template and upload it in the configuration and the VIEW page UI is changed.
I would be grateful if there are some pointers to help me in this direction or atleast can say about the feasibility part of it or an alternative.
Thanks
Environment: Liferay 6.2 GA1

Customizing the SharePoint 2010 Blog Template

I want to apply branding to a sharepoint 2010 blog site which is a sub site of our internet. I'm trying to achieve this by creating a custom blog site template based on the original blog site template. So I followed the following blog post.
http://www.sharepointbits.com/blog/sharepoint-2010-custom-site-templates.html
And I got a copy of the blog template files from "C:...\14\TEMPLATE\SiteTemplates\blog", modified the files and put in to the "SiteTemplates\" folder.
I can see a new site template has been created but every time when I create a web site based on my custom template it uses the original blog template files for provisioning (for ex: default.aspx).
Is this the correct way to achieve this? Please let me know if I'm doing sth wrong here.
Thanks in advance.
-Madhawa
Have you created a custom webtemp file in 14\TEMPLATE\1033\XML that has a custom Template Name with a SetupPath that points to your copied folder in SiteTemplates?
Also, the Blog site definition is tricky. The custom lists are built right into the onet.xml file. I wonder if creating a custom copy of the Blog template will work as well as copying other site types would. I would probably use feature stapling to apply custom branding to the out of the box Blog template within your site collection.

How to get Site Template Back?

I have saved a site as tempalte (i.e. MyMarketing.stp) and added to sharepoint server using stsadm addtemplate command and after few days lost MyMarketing.stp file. Now it is available for creating top level sites as well. I want to get this site template back as MyMarketing.stp file. Is it possible to extract it from the server as MyMarketing.stp file?
Thanks and in advance!
Regards,
Asher
Create an new site based on the template, then use http://SITEURL/_layouts/savetmpl.aspx to save the site in it's own site template gallery. you can now download the .stp file from that gallery.
Alternatively you could use SharePoint designer to export the site as a template.