Skip to main content

Posts

Showing posts from December, 2012

Apply Custom Master Page To Site using Power Shell

function ApplyMasterPageToSearchSite([string] $siteURL, [string] $SiteName) {         $subsiteurl = $siteURL + "/" + $SiteName + "/default.aspx"         Enable-SPFeature -identity "94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" -url $subsiteurl         Start-SPAssignment -Global         $site = Get-SPSite $siteURL         Write-Host "Get the Site" -foregroundcolor green         $topWeb = Get-SPWeb $site.Url         Write-Host "Update Master Page to search" -foregroundcolor green         $site | Get-SPWeb -limit all | ForEach-Object { $_.MasterUrl = "/_catalogs/masterpage/LMSSearchMaster.master";$_.Update() }         Write-Host "Master Page assigned" -foregroundcolor green         Stop-SPAssignment -Global         $site.Dispose() }

Create Search Scope and apply ruele using power shell also define Search Setting to Site Collection

[string]$searchSiteName = "Search" # Creates the search scope on site so it shows on the dropdown function CreateSearchScope([string] $siteURL){     # Variables for Site     [string]$searchServiceApplicationName = "Search Service Application"     [string]$adminServiceName = "SPAdmeinV4"     [string]$lmsContentTypeTemplateID = "STS_ListItem_10001"     [string]$searchDropDownValue= "Search Dropdown"     [string]$scopeName = "LMS Search"     # Gets the Search Service Application Object     Write-Host "Get-SPEnterPriseSearchServiceApplication" -foregroundcolor green     $ssa = Get-SPEnterPriseSearchServiceApplication -Identity $searchServiceApplicationName     # Get the root web     Write-Host "Get the root web." -foregroundcolor green     $site = New-Object Microsoft.SharePoint.SPSite($siteURL)     # Gets the scope     Write-Host "Get-SPEnterpriseSearchQueryScope" -foregroundcolor green     $scope =

Apply C# code in Power Shell Script

  Apply C# code in Power Shell # ----------- Csharp code for variations -------------- $Assem = (     "System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"    ,     "Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ,     "Microsoft.Office.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"             )     $Source = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint; using Microsoft.SharePoint.Publishing; using Microsoft.SharePoint.Administration; using System.Threading; using Microsoft.Office.Server; using Microsoft.Office.Server.Search.Administration; us

Custom Search Result using XSLT

 XSLT for Display search result in box format. Copy this xslt in to Search Core Results webpart's  XSL Editors Properties. <xsl:stylesheet version="1.0" xmlns:wxsl="http://www.w3schools.com/w3style.xsl" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">   <xsl:output method="xml" indent="yes"/>   <!--this tamplate is main tamplate wich calls dvt_1 and main root template of this xslt.-->   <xsl:template match="/">     <style type="text/