Tuesday, April 1, 2014

Apply SharePoint 2013 Theme to SiteCollection and its sub site using PowerShell Script


//Add the snapin for the power shell
Add-PSSnapin "microsoft.sharepoint.powershell"



//Set the site collection URL where the theme has to be applied
$url = "Site Collection URL"
$web = Get-SPWeb $URL

//Select the pallet color file,  if you do not have create one from this link.
$file = $web.GetFile($web.ServerRelativeUrl + "/_catalogs/theme/15/MyTheme01.spcolor")

$theme = [Microsoft.SharePoint.Utilities.SPTheme]::Open("MyTheme", $file)
$theme.ApplyTo($web,$true)
$site = Get-SPSite -Identity $url
Write-Host "RootWeb Theme: " + $site.RootWeb.ThemedCssFolderUrl
foreach ($web in $site.AllWebs) {
Write-Host "Web Title: " $web.Title
$web.AllowUnsafeUpdates=$true;
  Write-Host "Web Theme CSS: " $web.ThemeCssUrl
Write-Host "Web Theme: " $web.ThemedCssFolderUrl
$web.ThemedCssFolderUrl = $site.RootWeb.ThemedCssFolderUrl
Write-Host "Web Theme: " $web.ThemedCssFolderUrl
$web.Update()
$web.AllowUnsafeUpdates=$false;
$web.Dispose()
}
$site.Dispose();


PS: The above code is tested in my development server and it runs perfect for SharePoint 2013 and its the risk of the users to run the code in their environment. So run at your own risk! :)

Happy Browsing!
Relax..

SharePoint 2010 Custom Error Page using HTML


Steps to set the custom HTML error page for the SharePoint 2010

1. Prepare your HTML error message page/file and place it in the hive folder ( I'm using a sub folder here 14/CustomError) in the web front end server
2. Open the PowerShell in the administator mode and run the below command.(in all the web front end server)
Set-SPCustomLayoutsPage -Identity Error -RelativePath /_layouts/14/CustomError/error.html -WebApplication  http://sharepointsitecollectionurl


For see the error (Enabling Error Details)
Web.Config >> Enable stack trace ( true) and custom error mode = Off


And this script will not run on the SharePoint 2013 as the error pages are given directly in the Site Collection pages library.

PS: The above code is tested in my development server and it runs perfect for SharePoint 2010 and its the risk of the users to run the code in their environment. So run at your own risk!

More on this http://technet.microsoft.com/en-us/library/ff607768.aspx

Happy Browsing!
Relax..

 Rotating Banner or Slideshow -Free Javascript for Standalone page

A easy and free approach for the rotating banner or images or div that can be used to decorate the home pages of your website.  It has been tested and works in latest versions of all browsers.

For the code, please click here.

Please see this post for free sample and code: http://blog.crondesign.com/2012/01/free-javascript-for-rotating-website.html 

Happy Browsing!
Relax..