Use PowerShell to list your Views

In case you want to see what’s happening behind the scenes when you add a List View Web Part to your page, jump out to PowerShell (on the SharePoint server) and take a look:

 

 

So what’s happening here?

 

PS C:\> [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

This lets me use the Microsoft.SharePoint assembly.

 

PS C:\> $site = New-Object Microsoft.SharePoint.SPSite("http://wssdemo.spdemo.local/CA")

PS C:\> $web = $site.OpenWeb()

PS C:\> $list = $web.Lists["Products"]

This creates an SPSite object, gets the SPWeb (which contains the site’s lists), and then gets the SPList object for the Products list.

 

PS C:\> $list.Views | Format-Table

This shows me some details about the list’s views in a (sort of) pretty table view

 


Posted 11-01-2007 8:22 AM by Raymond Mitchell

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Inetium, LLC. Disclaimer