Forum Discussion

vassp1980's avatar
vassp1980
Copper Contributor
Jul 31, 2024

Is it possible to show the "All Documents" view in a SharePoint Library only to admins

Hello All,

 

There is a Document Library "working documents" that has two views.  One is the "All Documents" view which shows all the documents uploaded by all people.  There is another view "My Documents" that I created, which only shows documents uploaded by me (I have filtered this My Documents view to only show ones by me)

The requirement is as follows  : 

-The "All Documents" view should not be seen by any regular user.  It should only be visible by admins (For eg, users belong to a specific M365 group or specific users)
-So the goal is when a user accesses this library to upload documents, they should not see "All documents" view, and just be defaulted to the "my documents" view

Please advice how can we achieve this and hide the All docs view for uploading users, and show it only for a specific group of people like admins


1 Reply

  • JaredMatfess's avatar
    JaredMatfess
    Iron Contributor
    I think it's more of a security by-obscurity situation but you could potentially just hide the view using PNP PowerShell:

    Connect-PnPOnline -Url <SiteUrl> -Credentials (Get-Credential)

    $list = Get-PnPList -Identity "<ListName>"
    $view = $list.Views.GetByName("<ViewName>")

    $view.Hidden = $true
    $view.Update()

    --
    Then, for your admins, you can include a link in the navigation to the URL for the view (that's hidden) and use audience targeting to share the URL with them.

    That should technically enable what you're looking for. But remember, if a user has that URL they would be able to get to it.

Resources