Posts

Update Solution with Powershell

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue $SolutionPackageName = "MySolution.wsp" $SolutionPackagePath = "C:\PowershellSetup\MySolution.wsp" Write-Host "Checking Solution exist or not..." -foregroundcolor Yellow $solution = Get-SPSolution | where-object {$_.Name -eq $SolutionPackageName} if($solution -ne $null) { Write-Host "Solution Found & Updating Solution..." -foregroundcolor Green Update-SPSolution -Identity $SolutionPackageName -LiteralPath $SolutionPackagePath -Local -GACDeployment -Force Write-Host "Solution Updated..." -foregroundcolor Yellow } Write-Host "Solution Updation Complete." -foregroundcolor Green

Install WSP with Powershell

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue $SolutionPackageName = "MySolution.wsp" $SolutionPackagePath = "C:\PowershellSetup\MySolution.wsp" Write-Host "Checking Solution exist or not..." -foregroundcolor Yellow $solution = Get-SPSolution | where-object {$_.Name -eq $SolutionPackageName} if($solution -ne $null) { Write-Host "Solution Found..." -foregroundcolor Green if($solution.Deployed -eq $true) { Write-Host "Uninstalling Solution..." -foregroundcolor red Uninstall-SPSolution -Identity $SolutionPackageName -Local -Confirm:$false Write-Host "Uninstallation Done..." -foregroundcolor Yellow } Write-Host "Removing Solution..." -foregroundcolor red Remove-SPSolution -Identity $SolutionPackageName -Confirm:$false Write-Host "Solution Removed..." -foregroundcolor Yellow } Write-Host "Adding Solution..." -foregroundcolor red Add-SPSolution -LiteralPath $Sol

Install WSP with Powershell

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue $SolutionPackageName = "MySolution.wsp" $SolutionPackagePath = "C:\PowershellSetup\MySolution.wsp" Write-Host "Checking Solution exist or not..." -foregroundcolor Yellow $solution = Get-SPSolution | where-object {$_.Name -eq $SolutionPackageName} if($solution -ne $null) { Write-Host "Solution Found..." -foregroundcolor Green if($solution.Deployed -eq $true) { Write-Host "Uninstalling Solution..." -foregroundcolor red Uninstall-SPSolution -Identity $SolutionPackageName -Local -Confirm:$false Write-Host "Uninstallation Done..." -foregroundcolor Yellow } Write-Host "Removing Solution..." -foregroundcolor red Remove-SPSolution -Identity $SolutionPackageName -Confirm:$false Write-Host "Solution Removed..." -foregroundcolor Yellow } Write-Host "Adding Solution..." -foregroundcolor red Add-SPSol

SQL Server 2012 Installation & Configuration for SharePoint 2013

I found best video tutorial & blog which describe how to install & configure SQL Server 2012 for SharePoint 2013. Here you can find : Set Up SQL Server 2012 as a SharePoint 2013 Database Server Configure SQL Server 2012 for SharePoint 2013 Fine-Tune Your SQL Server 2012 Configuration for SharePoint 2013

Update a web part programmatically

This is an example how we can update a web part programmatically in multiple sites. LiteralControl lit = new LiteralControl(); lit.Text = ""; try { using (SPSite site = new SPSite(SPContext.Current.Web.Site.RootWeb.Url)) { for (int i = 1; i < site.AllWebs.Count; i++) { lit.Text += "<BR/>" + site.AllWebs[i].Title; SPFile file=site.AllWebs[i].GetFile(site.AllWebs[i].ServerRelativeUrl + "/default.aspx"); if ( file.Exists) { using (Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager wpm = site.AllWebs[i].GetLimitedWebPartManager(file.Url, PersonalizationScope.Shared)) { foreach (WebPart wp in wpm.WebParts) { if (wp.Title == "Notes") { wp.Height = new Unit("200px"); wpm.SaveChanges(wp); break; } } } } } } } catch (Exception ex) { lit.Text += "<BR/>" + ex.ToString(); } this.Controls.Add(lit);