SharePoint 2013 API中缺少SPRibbon

时间:2014-01-17 16:15:36

标签: sharepoint sharepoint-2013 ribbon

我只是将一些代码从SharePoint 2010移植到SharePoint 2013,我发现尽管documentation说SPRibbon类仍然有它,但是类定义中缺少TrimById()方法(如下所示) 。是否有任何新的方法来修剪我不知道的SP2013色带?

[下面的SPRibbon类定义]

#region Assembly Microsoft.SharePoint.dll, v15.0.0.0
// C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.dll
#endregion

using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using System;
using System.Collections;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Xml;

namespace Microsoft.SharePoint.WebControls {
    // Summary:
    //     Provides access to the ribbon on a page.
    [ParseChildren(ChildrenAsProperties = false)]
    public sealed class SPRibbon : Microsoft.Web.CommandUI.Ribbon {
        public const string AccessRequestsContextualGroupCommand = "AccessRequestsContextualGroup";
        public const string AccessRequestsContextualGroupId = "Ribbon.AccessRequestsContextualGroup";
        public const string AccessRequestsEditTabId = "Ribbon.AccessRequestsContextualGroup.Edit";
        public const string BlogListsTabId = "Ribbon.Blog.Lists";
        public const string CalendarContextualGroupCommand = "CalendarContextualGroup";
        public const string CalendarContextualGroupId = "Ribbon.Calendar";
        public const string CalendarEventTabId = "Ribbon.Calendar.Events";
        public const string CalendarTabId = "Ribbon.Calendar.Calendar";
        public const string CategoriesTabId = "Ribbon.Blog.Categories";
        public const string CommentsTabId = "Ribbon.Blog.Comments";
        public const string CustomCommandsId = "Ribbon.CustomCommands";
        public const string DiscussionBoardVisibilityContext = "WSSDiscussionBoardVisibilityContext";
        public const string DiscussionModerationTabId = "Ribbon.DiscussionModerationTab";
        public const string DocLibListFormRibbonTabId = "Ribbon.DocLibListForm.Edit";
        public const string DocumentContextualGroupCommand = "DocumentContextualGroup";
        public const string DocumentContextualGroupId = "Ribbon.DocumentContextualGroup";
        public const string DocumentTabId = "Ribbon.Document";
        public const string EditFormVisibilityContext = "WSSEditForm";
        public const string EditingToolsContextualGroupId = "Ribbon.EditingTools";
        public const string EditTabId = "Ribbon.EditingTools.CPEditTab";
        public const string ExtensibilityVisibilityContext = "WSSExtensibility";
        public const string FormatTextTabId = "Ribbon.FormatText";
        public const string FullPageVisibilityContext = "WSSFullPage";
        public const string GeneralVisibilityContext = "WSSGeneral";
        public const string ImageContextualGroupId = "Ribbon.Image";
        public const string ImageImageTabId = "Ribbon.Image.Image";
        public const string LibraryContextualGroupCommand = "LibraryContextualGroup";
        public const string LibraryContextualGroupId = "Ribbon.LibraryContextualGroup";
        public const string LibraryPermissionsButtonId = "Ribbon.Library.Settings.LibraryPermissions";
        public const string LibraryTabId = "Ribbon.Library";
        public const string LinkContextualGroupId = "Ribbon.Link";
        public const string LinkLinkTabId = "Ribbon.Link.Link";
        public const string ListAndLibraryVisibilityContext = "WSSListAndLibrary";
        public const string ListContextualGroupCommand = "ListContextualGroup";
        public const string ListContextualGroupId = "Ribbon.ListContextualGroup";
        public const string ListFormRibbonDispTabId = "Ribbon.ListForm.Display";
        public const string ListFormRibbonTabId = "Ribbon.ListForm.Edit";
        public const string ListItemContextualGroupCommand = "ListItemContextualGroup";
        public const string ListItemContextualGroupId = "Ribbon.ListItemContextualGroup";
        public const string ListItemTabId = "Ribbon.ListItem";
        public const string ListTabId = "Ribbon.List";
        public const string NonEventsListVisiblityContext = "WSSNonEventsList";
        public const string NonLinksListVisibilityContext = "WSSNonLinksList";
        public const string NonSpecialFormVisibilityContext = "WSSNonSpecialFormVisibilityContext";
        public const string PageInsertTabId = "Ribbon.EditingTools.CPInsert";
        public const string PageStateVisibilityContext = "WSSPageStateVisibilityContext";
        public const string PermissionContextualGroupCommand = "PermissionContextualGroup";
        public const string PermissionContextualGroupId = "Ribbon.PermissionContextualGroup";
        public const string PermissionsTabId = "Ribbon.Permission";
        public const string PermissionVisibilityContext = "WSSPermission";
        public const string PostFormRibbonTabId = "Ribbon.PostListForm.Edit";
        public const string PostsTabId = "Ribbon.Blog.Posts";
        public const string PublishTabId = "Ribbon.PublishTab";
        public const string ReadTabId = "Ribbon.Read";
        public const string RTEVisibilityContext = "WSSRTE";
        public const string SolutionTabId = "Ribbon.Solution";
        public const string SpecialFormVisibilityContext = "WSSSpecialFormVisibilityContext";
        public const string TableContextualGroupId = "Ribbon.Table";
        public const string TableDesignTabId = "Ribbon.Table.Design";
        public const string TableLayoutTabId = "Ribbon.Table.Layout";
        public const string TabPersistenceVisibilityContext = "WSSTabPersistence";
        public const string TasksContextualGroupCommand = "TasksContextualGroup";
        public const string TasksContextualGroupId = "Ribbon.TasksContextualGroup";
        public const string TasksListTabId = "Ribbon.TasksList";
        public const string TasksTabId = "Ribbon.Tasks";
        public const string TestTabId = "Ribbon.Test";
        public const string TimecardTabId = "Ribbon.Timecard";
        public const string TimelineTabId = "Ribbon.Timeline";
        public const string VirtualListVisibilityContext = "WSSVirtualList";
        public const string WebApplicationManagementTabId = "Ribbon.WebApp";
        public const string WebPartContextualGroupCommand = "WebPartContextualGroup";
        public const string WebPartContextualGroupId = "Ribbon.WebPartCtx";
        public const string WebPartInsertContextualGroupCommand = "WebPartInsertContextualGroup";
        public const string WebPartInsertContextualGroupId = "Ribbon.WebPartInsert";
        public const string WebPartInsertRelatedListTabId = "Ribbon.WebPartInsert.InsertRelatedDataToListForm";
        public const string WebPartInsertTabId = "Ribbon.WebPartInsert.Tab";
        public const string WebPartPageTabId = "Ribbon.WebPartPage";
        public const string WebPartPageVisibilityContext = "WSSWebPartPage";
        public const string WebPartTabId = "Ribbon.WebPartOption";
        public const string WikiEditTabId = "Ribbon.EditingTools.CPEditTab";
        public const string WikiInsertTabId = "Ribbon.EditingTools.CPInsert";
        public const string WikiPageTabId = "Ribbon.WikiPageTab";
        public const string WikiPageVisibilityContext = "WSSWikiPage";

        // Summary:
        //     Initializes a new SPRibbon class object.
        public SPRibbon();

        [Category("Behavior")]
        [DefaultValue(true)]
        public bool ApplyPermissionsToRibbonOnly { get; set; }
        [Category("Behavior")]
        [DefaultValue("AuthenticationRestrictions.AllUsers")]
        public AuthenticationRestrictions AuthenticationRestrictions { get; set; }
        [Category("Behavior")]
        [DefaultValue(true)]
        public override bool CheckForInitializationReadiness { get; set; }
        public override bool CommandUIVisible { get; set; }
        public string CssFile { get; set; }
        protected override string InitializationScript { get; }
        protected override string InitializationStartScript { get; }
        [Category("Behavior")]
        [DefaultValue("PageModes.All")]
        public PageModes PageModes { get; set; }
        [Category("Behavior")]
        [DefaultValue("PermissionContext.CurrentSite")]
        public PermissionContext PermissionContext { get; set; }
        [Category("Behavior")]
        [DefaultValue("PermissionMode.All")]
        public PermissionMode PermissionMode { get; set; }
        [Category("Behavior")]
        [DefaultValue("SPBasePermissions.EmptyMask")]
        public SPBasePermissions Permissions { get; set; }
        [Category("Behavior")]
        [DefaultValue("")]
        public string PermissionsString { get; set; }
        [Category("Behavior")]
        [DefaultValue("")]
        public SPContext RenderContext { get; set; }
        protected override string RootBuildClientScript { get; }

        // Summary:
        //     Returns an instance of the ribbon on the specified page.
        //
        // Parameters:
        //   page:
        //
        // Returns:
        //     Returns Microsoft.SharePoint.WebControls.SPRibbon.
        public static SPRibbon GetCurrent(Page page);
        public static string GetWebPartPageComponentId(WebPart webPart);
        public void MakeRTEContextualTabsAvailable(string visibilityContext);
        public void MakeWikiTabsAvailable();
        protected override void OnInit(EventArgs e);
        protected override void OnPreRender(EventArgs e);
        protected override void Render(HtmlTextWriter writer);
    }
}

1 个答案:

答案 0 :(得分:1)

没关系。如上所示,SPRibbon类继承自Microsoft.Web.CommandUI.Ribbon。我所要做的就是将程序集Microsoft.Web.CommandUI.dll添加到项目参考中并且vo!现在一切正常。