2

我有一个要求,我需要删除或隐藏套件栏中显示的默认链接,如 NewsFeed、SkyDrive、站点等。我想添加自己的链接并将此部分用作我的菜单。

因此,在添加时,我希望内容编辑器可以轻松配置这些项目。他们可以编辑需要显示的链接并控制顺序。没有硬编码链接。

如果有人可以在这方面提供帮助。

套房酒吧定制

问候,导航

4

3 回答 3

2

这可以通过显示这些链接的其他代表控件来完成。以下链接将有所帮助

http://www.learningsharepoint.com/2013/02/10/addremove-links-in-top-suitebar-skydrivesitesnewsfeed-in-sharepoint-2013/

于 2013-02-20T21:30:23.180 回答
2

You should create a custom delegate control that target the SuiteLinksDelegate ControlId. Add it to a Farm-scoped feature to make the custom delegate control active in the whole farm. If you do not like hard-coded links you can program against a custom SharePoint list that stores the configurable links.

To Add custom links you can use the approach described here: http://zimmergren.net/technical/sp-2013-some-new-delegatecontrol-additions-to-the-sharepoint-2013-master-pages

If you need to remove some built-in links while keeping others (I had this requirement) you can use code like this:

    public partial class SuiteLinksDelegate : MySuiteLinksUserControl
    {
        protected override void Render(HtmlTextWriter writer)
        {
            // save for later
            var httpwriter = (writer.InnerWriter as HttpWriter);

            // hijack the innerwriter
            var sb = new StringBuilder();
            var sw = new StringWriter(sb);
            var tw = new HtmlTextWriter(sw);
            writer.InnerWriter = tw;

            // call base
            base.Render(writer);

            // get the html
            var currentHtml = sb.ToString();
            XElement element = XElement.Parse(currentHtml);

            // remove SkyDrive link
            var suiteLinkNodes = element.Elements("li").ToArray();
            var remainingNodes = suiteLinkNodes.Where(node => !(node.ToString().Contains("ShellDocuments")));
            element.ReplaceNodes(remainingNodes);

            var modifiedHTML = element.ToString();

            // set back the old innerwriter
            writer.InnerWriter = httpwriter;

            // write delegate control html
            httpwriter.Write(modifiedHTML);
        }
    }
于 2013-10-21T08:21:42.667 回答
1

您可以使用 javascript 方法来隐藏此链接,如下面的链接所述

http://www.tuyrcorp.com/sharepoint-2013-top-links-name-id-and-how-to-hide-them/

您也可以使用相同的 javascript 在下拉列表中添加新项目

希望这可以帮助

谢谢

于 2013-02-06T11:50:26.643 回答