Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-PSSnapIn Microsoft.SharePoint.PowerShell
- $containerCode = @"
- <div id='webTitleContainer' class='ms-core-brandingText'></div>
- <script type='text/javascript'>
- (function() {
- // Set a default title to use if we cannot retrieve one.
- var defaultTitle = '';
- // Ensure that both the DOM and the Object Model are ready for us
- document.addEventListener('DOMContentLoaded', function() {
- EnsureScriptFunc('sp.js', 'SP.ClientContext', function() {
- // Get and load a reference to the root web of the current site collection.
- var context = new SP.ClientContext.get_current();
- var web = context.get_web();
- context.load(web);
- // Query SharePoint for the current sites title and URL
- context.executeQueryAsync(function(){
- var title = web.get_title();
- var url = web.get_url();
- // If the current site isn't the homepage then add the title and link of the current site to the top bar
- if(title != 'SharePoint Home' && title != 'Home') {
- document.getElementById('titleContainer').innerHTML = title;
- document.getElementById('currentSiteUrl').href = url;
- document.getElementById('titleDivider').style.display = 'inline'
- document.getElementById('titleContainer').style.display = 'inline';
- }
- },
- function(sender,args){
- console.log(args.get_message());
- }
- );
- });
- });
- function titleBarRenamer() {
- // Get and load a reference to the root web of the current site collection.
- var context = new SP.ClientContext.get_current();
- var web = context.get_web();
- context.load(web);
- context.executeQueryAsync(function(){
- // Query for the current site title
- var title = web.get_title();
- var url = web.get_url();
- if(title != 'SharePoint Home' && title != 'Home') {
- document.getElementById('titleContainer').innerHTML = title;
- document.getElementById('currentSiteUrl').href = url;
- document.getElementById('titleDivider').style.display = 'inline'
- document.getElementById('titleContainer').style.display = 'inline';
- }
- },
- function(sender,args){
- console.log(args.get_message());
- }
- );
- }
- })();
- </script>
- "@
- $webApp = Get-SPWebApplication -Identity "*SharePointUrl*"
- $webApp.SuiteBarBrandingElementHtml = "<div class='ms-core-brandingText'><a href='*SharePointUrl*' style='color:#fff;'><img style='margin-bottom:-1px; padding-right:5px;' src='*fullLinkToImage*'>SharePoint Home</a><span id='titleDivider' style='display:none;'> - </span><a id='currentSiteUrl' href='#' style='color:#fff;'><span id='titleContainer' style='display:none;'>$containerCode</span></a></div>"
- $webApp.Update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement