当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 更改 SharePoint 2013 套件栏中的“SharePoint”品牌文本

作者:精品下载站 日期:2024-12-14 13:41:01 浏览:12 分类:玩电脑

更改 SharePoint 2013 套件栏中的“SharePoint”品牌文本


是否曾经想要更改 SharePoint 2013 网站套件栏(左上角位置)中的“SharePoint”品牌文本?

[玩转系统] 更改 SharePoint 2013 套件栏中的“SharePoint”品牌文本

那么,您可以使用 PowerShell/对象模型代码设置 Web 应用程序的 SuiteBarBrandingElementHtml 属性,以更改 SharePoint 2013 网站左上角横幅中显示的文本“SharePoint”。

使用 PowerShell 自定义 SharePoint 2013 套件栏品牌:

以下是在 SharePoint 2013 中添加链接到套件栏的 PowerShell 脚本。


Add-PSSnapin Microsoft.SharePOint.PowerShell
#Get the Web Application
$webApp = Get-SPWebApplication "https://extranet.crescent.com/"

#Set the "SharePoint" text Property 
$webApp.SuiteBarBrandingElementHtml = "Crescent Extranet"

# You can also replace it with Clickable Hyperlink - Images
# $webApp.SuiteBarBrandingElementHtml = '<div class="ms-core-brandingText"><a href="https://extranet.crescent.com"><img src="https://extranet.crescent.com/SiteAssets/crescent_logo.png"/></a></div>'  

#Update changes
$webApp.Update()

这是行动的结果:

[玩转系统] 更改 SharePoint 2013 套件栏中的“SharePoint”品牌文本

使用 SharePoint 2013 母版页自定义 SharePoint 2013 套件栏品牌的 jQuery 方法:

要更改套件栏中的“SharePoint”品牌文本,您还可以使用 jQuery。只需在 SharePoint 设计器中打开母版页,找到 标记并将此代码放入其中即可。


<script type="text/javascript" src="https://code.jquery.com/jquery-1.2.6.min.js"></script>

<script type="text/javascript">
 $(document).ready(function() {
 var suiteBar = $("#suiteBar").find(".ms-core-brandingText");
 suiteBar.html("<a style='color:white' href='https://extranet.crescent.com'>Crescent Extranet</a>");   
  });
</script>

使用 CSS 替换“SharePoint”品牌文本:
将此 CSS 放置在您的母版页中。


<style>
     .ms-core-brandingText {
           text-indent: -95px;
       }
    .ms-core-brandingText:after {  
          content: " Crescent Inc.";
    }
</style> 

顺便说一句,它实际上是一个委托控件,如果您需要基于解决方案的方法,可以用 Visual Studio 中内置的用户控件解决方案替换它。更多信息请参见:SuiteBarBrandingDelegate 委托控制

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯