I have been changed the Search Placeholder name by modifying the Control search box.HTML from display template file, I need to move my changes into another server. Please suggest me any ideas to achieve this?
3 Answers
Using the migration tool, select the option to copy the object that include templates, master pages, and Style Library. and just migrate it to the new site it's very simple by using ShareGate tool
-
Thanks, Is there has any way to achieve it by code. I mean PowerShell scripts, etc) @JishinDebugger– Debugger2016-11-11 05:30:12 +00:00Commented Nov 11, 2016 at 5:30
How to Upload the Display Templates into SharePoint 2013 Using PowerShell:
##================================================================================================
## Description : To do the below two items.
#1. Upload the Display Templates into Site Collection
## Author : Sathish Nadarajan
## Date : 06-Oct-2015
##================================================================================================
##============================================ Setup Input Paths ===========================================================
cls
$Host.UI.RawUI.WindowTitle = "-- Upload the Display Templates into Site Collection --"
$StartDate = Get-Date
Write-Host -ForegroundColor White "------------------------------------"
Write-Host -ForegroundColor White "| Upload the Display Templates into Site Collection |"
Write-Host -ForegroundColor White "| Started on: $StartDate |"
Write-Host -ForegroundColor White "------------------------------------"
$LogTime = Get-Date -Format yyyy-MM-dd_hh-mm
$LogFile = ".\UploadDisplayTemplates-$LogTime.rtf"
#start-transcript $logfile
$scriptBase = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent
Set-Location $scriptBase
$ErrorActionPreference = "Stop"
function AddPowerShellSnapin()
{
try
{
Write-Host "Adding PowerShell Snap-in" -ForegroundColor Green
# Try to get the PowerShell Snappin. If not, then adding the PowerShell snappin on the Catch Block
Get-PSSnapin "Microsoft.SharePoint.PowerShell"
}
catch
{
if($Error[0].Exception.Message.Contains("No Windows PowerShell snap-ins matching the pattern 'Microsoft.SharePoint.PowerShell' were found"))
{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
}
Write-Host "Finished Adding PowerShell Snap-in" -ForegroundColor Green
}
function UploadDisplayTemplates([string]$siteUrl)
{
$spsite = Get-SPSite $siteUrl
$web = $spsite.RootWeb
$contentWebPartsDisplayTemplatesFolder = ($web).GetFolder("Content Web Parts")
$displayTemplatesDirectory = $scriptBase + "\DisplayTemplates"
$web.AllowUnsafeUpdates=$true;
#For upload all files in document library from file system
foreach ($file in Get-ChildItem $displayTemplatesDirectory)
{
try
{
$stream = [IO.File]::OpenRead($file.fullname)
$destUrl = $web.Url + "/_catalogs/masterpage/Display Templates/Content Web Parts/" + $file.Name;
$displayTemplateFile = $web.GetFile($destUrl)
if($displayTemplateFile.CheckOutStatus -ne "None")
{
$contentWebPartsDisplayTemplatesFolder.files.Add($destUrl,$stream,$true)
$stream.close()
$displayTemplateFile.CheckOut();
$displayTemplateFile.CheckIn("CheckIn by PowerShell");
$displayTemplateFile.Publish("Publish by PowerShell");
$displayTemplateFile.Update();
$web.Update();
Write-Host $file.Name " Display Template Page uploaded on $web site" -ForegroundColor Green
}
else
{
$displayTemplateFile.CheckOut();
try
{
$contentWebPartsDisplayTemplatesFolder.Files.Add($destUrl,$stream,$true)
}
catch
{
Write-Host $_
}
$stream.close()
$displayTemplateFile.CheckIn("CheckIn by PowerShell");
$displayTemplateFile.Publish("Publish by PowerShell");
$displayTemplateFile.Update();
$web.Update();
Write-Host $file.Name " Display Template Page uploaded on $web site" -ForegroundColor Green
}
}
catch
{
Write-Host $_
}
}
$web.AllowUnsafeUpdates = $false;
$web.dispose();
$spsite.dispose();
}
try
{
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Sharepoint")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Sharepoint.Administration")
$ConfigXmlPath = $scriptBase + "\Configuration.xml"
Write-Host "Read the Config Values" -ForegroundColor Green
[Xml]$Config = Get-Content $ConfigXmlPath
AddPowerShellSnapin
UploadDisplayTemplates $Config.Configuration.PublishingSite.URL # SiteCollection URL
}
catch
{
Write-Host "Custom Exception Happened on Main : " + $Error[0].Exception.Message -ForegroundColor Red
}
#stop-transcript
In addition to above few more migration tool out there, you can try like AvePoint and Lepide to accomplish this migration task easily and efficiently.
Thanks,