找了好久原因的一个错误,就是当你打开Pages Library的Library Settings页面时提示unexpected错误,如果打开web.config的详细错误信息或查看ULS logs的时候会看到如下的错误信息:
SharePoint Foundation Runtime tkau Unexpected System.Web.HttpException: The DataSourceID of 'TopNavigationMenu' must be the ID of a control of type IHierarchicalDataSource. A control with ID 'topSiteMap' could not be found.
at System.Web.UI.WebControls.HierarchicalDataBoundControl.GetDataSource()
at System.Web.UI.WebControls.HierarchicalDataBoundControl.ConnectToHierarchicalDataSource()
at System.Web.UI.WebControls.HierarchicalDataBoundControl.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Web Content Management Publishing 8vzh Unexpected PortalSiteMapProvider was unable to fetch current node, request URL: /_layouts/listedit.aspx, message: Value cannot be null. Parameter name: key, stack trace:
at System.Web.SiteMapNode..ctor(SiteMapProvider provider, String key, String url, String title, String description, IList roles, NameValueCollection attributes, NameValueCollection explicitResourceKeys, String implicitResourceKey)
at System.Web.SiteMapNode..ctor(SiteMapProvider provider, String key, String url, String title, String description)
at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapNode..ctor(PortalSiteMapProvider provider, PortalWebSiteMapNode webNode, String key, NodeTypes type, String url, String title, String description)
at Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapProvider.get_CurrentNode()
DelegateControl: Exception thrown while adding control 'Microsoft.SharePoint.Publishing.Navigation.PortalSiteMapDataSourceSwitch': Object reference not set to an instance of an object.
错误原因:因为我有使用自定义Master Page,并且在其上添加了Form Field,例如:
<SharePointWebControls:UserField ID="123ABC" ControlMode="Display" CssClass="someClass" FieldName="GUID" runat="server" ></SharePointWebControls:UserField>
解决办法:把Form Field控件从Master Page移走,或者考虑使用Page Layouts或Resuable Content Field控件。我的处理是把Form Field移到了Page Layouts。