Monday, June 8, 2015

Change Site Logo using PowerShell and Server Side Code in SharePoint 2013




We can change the site logo using PowerShell in SharePoint 2013. Before running the PowerShell command make sure you saved your site logo in any of the document library like SiteAssets.

You may read:
- Configure Following settings in SharePoint 2013

- Calculate difference between two dates Excluding Weekend and Holiday date in SharePoint 2010

- Cancel not completed workflows using PowerShell in SharePoint 2013

Below is the PowerShell command to change the Site Logo:

Add-PSSnapin Microsoft.Sharepoint.Powershell

$web = Get-SPWeb http://SharePointSiteURL

$web.SiteLogoUrl = "/SiteAssets/MyCompanyLogo.png"

$web.SiteLogoDescription = "My Company Logo"

$web.Update()

$web.Dispose()

Server Side Code to Change Logo:
Below is the SharePoint server side code to change Logo.

using (var site = new SPSite("http://SharePointSiteURL"))
{
using (var web = site.OpenWeb())
{
web.SiteLogoUrl = "/SiteAssets/MyCompanyLogo.png";

web.SiteLogoDescription = "My Company Logo";

web.Update();
}
}


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Favorites More