SharePoint 2016: Discussion Board - My Discussions View - Problem and Workaround

Problem


With out-of the box Discussion Board in SharePoint 2016, when you try to navigate to the My Discussions view, users receive the following error:



Analysis


The ULS log contains the following entries related to the Corellation ID in the error message. And, I noticed that internally, the view queries field Author.


  • Throttled:Big list slow query. List item query elapsed time: 0 milliseconds, Additional data (if available): Query HRESULT: 80070024 List internal name, flags, and URL: {BEB8BA57-E62A-41DE-A037-4C5DE6D6C02A}, flags=0x00a0000020c01088, URL="http://{site}/_layouts/15/inplview.aspx?List={BEB8BA57-E62A-41DE-A037-4C5DE6D6C02A}&View={D61B6953-6AAD-4084-A58C-AC63A2444811}&ViewCount=0&IsXslView=TRUE&IsCSR=TRUE&HasOverrideSelectCommand=TRUE&ListViewPageUrl=http://{site}/Discussions/AllItems.aspx" Current User: 4 Query XML: "<Query><OrderBy UseIndexForOrderBy="TRUE" Override="TRUE"/><Where><Eq><FieldRef Name="Author"/><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Where></Query>" SQL Query: "N/A" 
  • Unable to execute query: Error 0x80070585
  • SPRequest.GetListItemDataWithCallback2: UserPrincipalName=i:0).w|s-1-5-21-224234051-1631930953-1592849230-1147, AppPrincipalName= ,pSqlClient=<null> ,bstrUrl=http://{site} ,bstrListName={BEB8BA57-E62A-41DE-A037-4C5DE6D6C02A} ,bstrViewName=<null> ,bstrViewXml=<View><Query><OrderBy UseIndexForOrderBy="TRUE" Override="TRUE"/><Where><Eq><FieldRef Name="Author"/><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Where></Query><ViewFields><FieldRef Name="ID"/><FieldRef Name="PermMask"/><FieldRef Name="Created"/><FieldRef Name="Modified"/><FieldRef N ,fSafeArrayFlags=SAFEARRAYFLAG_AUTOHYPERLINK
  • System.Runtime.InteropServices.COMException: Invalid index. (Exception from HRESULT: 0x80070585),
    StackTrace:   at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()  
    at Microsoft.SharePoint.SPListItemCollection.get_Count()  
    at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments, String aggregateString, Boolean wantReturn, BaseXsltListWebPart webpart, SPListItem& listItem, SPListItemCollection& listItems, String[]& fieldList)  
    at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal()  
    at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator()  
    at Microsoft.SharePoint.SPList.RenderListData(XsltListViewWebPart xslWebPart, SPView view, TextWriter output)  
    at Microsoft.SharePoint.SPList.RenderListDataPrivate(XsltListViewWebPart xslWebPart, SPView view, TextWriter writer)  
    at Microsoft.SharePoint.SPList.RenderAsHtml(SPQuery query, SPView view, String viewGuid, Boolean forceXslView, Boolean ecbMode, Boolean renderEcb, Boolean ignoreQString, Boolean renderForRenderListData, Boolean forceXslRender)  
    at Microsoft.SharePoint.ApplicationPages.InplaceViewEditor.RenderListView()  
    at Microsoft.SharePoint.ApplicationPages.InplaceViewEditor.Execute(String strCmd)  
    at Microsoft.SharePoint.ApplicationPages.InplaceViewEditor.OnLoad(EventArgs e)  
    at System.Web.UI.Control.LoadRecursive()  
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  
    at System.Web.UI.Page.ProcessRequest()  
    at System.Web.UI.Page.ProcessRequest(HttpContext context)  
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  
    at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)  
    at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)  
    at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)  
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  
    at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)  
    at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)  
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  
    at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)


Then, I checked the Author field properties:

Title InternalName Indexed Hidden
$Resources:core,Content_Version; ContentVersion True
App Created By AppAuthor False
App Modified By AppEditor False
Approval Status _ModerationStatus False True
Approver Comments _ModerationComments False True
Attachments Attachments False False
Best Response Id BestAnswerId False False
Body Body False False
Body MessageBody False True
Body Was Expanded BodyWasExpanded False True
Client Id SyncClientId True
Content Type ContentType False False
Content Type ID ContentTypeId False True
Copy Source _CopySource False True
Correct Body To Show CorrectBodyToShow False True
Created Created False False
Created Created_x0020_Date True
Created By Author False
Created By MyAuthor False
Discussion Subject DiscussionTitle False False
Discussion Title DiscussionTitleLookup True
Edit Edit False False
Edit Menu Table End _EditMenuTableEnd False True
Edit Menu Table Start _EditMenuTableStart False True
Edit Menu Table Start _EditMenuTableStart2 False True
Effective Permissions Mask PermMask False True
E-Mail Messages RelevantMessages False True
E-Mail Sender EmailSender False False
Encoded Absolute URL EncodedAbsUrl False True
File Name BaseName False True
File Type File_x0020_Type False True
Folder Child Count FolderChildCount False
Full Body FullBody False True
GUID GUID False True
Has Copy Destinations _HasCopyDestinations False True
HTML File Type HTML_x0020_File_x0020_Type False True
ID ID False False
Indentation Indentation False True
Indentation Level IndentLevel False True
Instance ID InstanceID False True
Is Answered IsAnswered True True
Is Current Version _IsCurrentVersion False True
Is Featured Discussion IsFeatured True False
Is Root Post IsRootPost False True
Item Type FSObjType True
Last Reply By LastReplyBy False
Last Updated DiscussionLastUpdated True False
Less Link LessLink False True
Level _Level False True
Limited Body LimitedBody False True
Message ID MessageId False True
Modified Last_x0020_Modified True
Modified Modified False False
Modified By Editor False
Modified By MyEditor False
More Link MoreLink False True
Name FileLeafRef False True
Name LinkFilename False True
Name LinkFilename2 False True
Name LinkFilenameNoMenu False True
Order Order False True
owshiddenversion owshiddenversion False True
Parent Folder Id ParentFolderId False True
Parent Item Editor ParentItemEditor False
Parent Item ID ParentItemID False False
Path FileDirRef True
Post BodyAndMore False False
Posted By PersonImage False True
Posted By PersonViewMinimal False False
Posting Information StatusBar False True
ProgId ProgId True
Property Bag MetaInfo True
Question IsQuestion False False
Quoted Text Was Expanded QuotedTextWasExpanded False True
References EmailReferences False True
Replies ItemChildCount False
Reply ReplyNoGif False False
Restricted Restricted True
ScopeId ScopeId True
Select SelectTitle False True
Server Relative URL ServerUrl False True
Shortest Thread-Index ShortestThreadIndex False True
Shortest Thread-Index Id ShortestThreadIndexId False True
Shortest Thread-Index Id Lookup ShortestThreadIndexIdLookup True
Sort Type SortBehavior True
Subject LinkDiscussionTitle False False
Subject LinkDiscussionTitle2 False False
Subject LinkDiscussionTitleNoMenu False False
Subject LinkTitleNoMenu False True
Subject Title False False
Thread Index ThreadIndex False True
Thread Topic ThreadTopic False True
Threading Threading False False
Threading Controls ThreadingControls False True
Title LinkTitle False False
Title LinkTitle2 False True
Toggle Quoted Text ToggleQuotedText False True
Trimmed Body TrimmedBody False True
Type DocIcon False False
UI Version _UIVersion False True
Unique Id UniqueId True
URL Path FileRef True
Version _UIVersionString False False
Workflow Instance ID WorkflowInstanceID False True
Workflow Version WorkflowVersion False True


And, the field is not indexed. 

Workaround

Making the field Author indexed fixes the issue

```powershell
$web = Get-SPWeb '{site url}'
$list = $web.Lists['Discussions']
$field = $list.Fields.GetFieldByInternalName('Author')
$field.Indexed = $true
$field.Update()
```

Comments

Popular posts from this blog

SharePoint PnP Management Shell - Permissions Consent

Useful SharePoint PowerShell Snippets