Hide a column in a view for an existing SharePoint List using PnP PowerShell

Mark Gorelyk 61 Reputation points
2022-01-20T11:40:20.927+00:00

Hi all,

I need to hide a column "test" in a certain view "view1" using PnP PowerShell.
I stumbled across this topic, but cannot figure out how to apply it for an existing list.
Any code snippet for an existing list would be appreciated!

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

Answer accepted by question author
  1. Yi Lu_MSFT 17,626 Reputation points
    2022-01-21T09:27:53.53+00:00

    Hi @Mark Gorelyk
    Per my test, this code works for the form when you new items, for example, you could not find "Title" in the form after running the command:

    Connect-PnPOnline -Url "https://crescent.sharepoint.com/sites/luyi"   
       
    Set-PnPField -List "test2" -Identity "Title" -Values @{Required=$False;Hidden=$True}  
    

    167128-image.png

    To hide the column in the view, you could use the command Set-PnPView, for example, when you use the command:

    Set-PnPView -List "Documents" -Identity "Corporate Documents" -Fields "Title","Created"  
    

    You will get a view to show the coumn "Title" and "Created".


    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.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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