SharePoint views depending on user groups

lablefromu 20 Reputation points
2024-04-24T06:46:12.8766667+00:00

Hi, I have a problem. I have a list of documents in a SharePoint library, and there are different columns for the "All documents" view and other columns for the "Visitor View." I want the "All documents" view to be default for SharePoint site admin groups, and I want the "Visitor View" to be default for users with viewer rights.

Additionally, viewers should not be able to switch the view to "All documents" from the "Visitor View."

Is there any way to achieve this?

I was thinking of creating a JSON file to check if the user is a part of the admin group and hide several columns from views if the user has no such rights.

For example, I could create a custom view with columns and create a JSON script for each columns that I don't want to be visible for users with only visitor view rights.

ChatGPT gave me the script, but it does not work

Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} votes

Accepted answer
  1. Yanli Jiang - MSFT 31,596 Reputation points Microsoft External Staff
    2024-04-24T09:25:12.1866667+00:00

    Hi @lablefromu ,

    You can try to use Document Library Web Part to make it.

    1. Create a blank Site Page and name it Visitor View.
    2. Then add a Document Library web part, select the target Library, and click Edit Web Part.
    3. First switch the view to Visitor View, then in the editing panel on the right, check Hide command bar and Hide "See all" Button. The final result will be as shown below:

    User's image

    1. After completing the above settings, Publish the Page.
    2. Click Share in the upper right corner of the Page, select the appropriate Permission, and share the Page to users who need to view this view.

    User's image

    Have a nice day!


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.