AnswerBun.com

How i can remove views from my discussion board List name "Answered Questions" & "Unanwered questions"

I have added a discussion board list inside my team site. but I want to remove some views such as: Answered question, unanswered questions, etc… I am not sure if these are standard view or just a filters:-

enter image description here

But I can not find a way to hide these views/filters "Unanswered questions" , "Answered Questions" & "Featured"

SharePoint Asked by user43231 on January 8, 2021

2 Answers

2 Answers

If you want to get rid of the views permanently, then you can also use this PowerShell fuction which deletes a view from the list.

function Delete-ListView()
{
    param(
        [Parameter(Mandatory=$true)][string]$url,
        [Parameter(Mandatory=$false)][System.Net.NetworkCredential]$credentials,
        [Parameter(Mandatory=$true)][string]$listName,
        [Parameter(Mandatory=$true)][string]$viewName
    )

    begin{
        try
        {
            #get Client Object
            $context = New-Object Microsoft.SharePoint.Client.ClientContext($url)
            $context.Credentials = $credentials

            #Retrieve List
            $list = $context.Web.Lists.GetByTitle($listName)
            $context.Load($list)
            $context.ExecuteQuery()
        }
        catch
        {
            Write-Host "Error while getting context. Error -->> "  + $_.Exception.Message -ForegroundColor Red
        }
    }
    process{
        try
        {
            $view = $list.Views.GetByTitle($viewName)
            $context.Load($view)
            $context.ExecuteQuery()

            $view.DeleteObject()
            $context.ExecuteQuery()

            Write-Host "View deleted successfully" -ForegroundColor Green
        }
        catch
        {
            Write-Host ("Error while deleting view for a List. Error -->> " + $_.Exception.Message) -ForegroundColor Red
        }
    }
    end{
        $context.Dispose()
    }


}

Usage:

# Get Credentials
#
$Creds = Get-Credential

# Function Call
#
Delete-ListView "http://YourSite.com" $Creds "Discussion Board" "Answered question"

Answered by Asad Refai on January 8, 2021

I am able to hide the unanswered and ... using below code:

.ms-comm-forumHeaderContainer
{
    width:300px;
    height:22px;
    overflow:hidden;
}

also for best reply

li[text='Best Reply']
{
    display:none !important;
}

Answered by Amay Kulkarni on January 8, 2021

Add your own answers!

Related Questions

Workflow task – How to set priority when assigning a task

1  Asked on December 28, 2021 by etho201

     

SharePoint 2010, how to change column width in list view

2  Asked on December 28, 2021 by j-osborn

     

Logical Architecture of SharePoint

1  Asked on December 26, 2021 by dasarp

   

Link Tracking Breaks Large List Views in Modern

2  Asked on December 26, 2021 by eliot-at-projectfive

       

Manipulate Filters in Javascript

1  Asked on December 24, 2021 by out-shire

       

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved.