Powershell GridView to help with SharePoint data viewing
The article below is using SharePoint Module for managing lists, items and files as an extension to SharePoint Online Management Shell. Install the module to proceed.
The article revisits a simple Powershell functionality of Out-GridView to show how - in combination with SPOMod - you can easily view or filter SharePoint Online lists, libraries and items.
Prerequisites
Time to finish: about 2 min
- Download and install SharePoint Online SDK.
- Download and import the SPOMod.
- Run Connect-SPOCSOM cmdlet:
Connect-SPOCSOM -Username test@TestTenant.onmicrosoft.com -Url https://testTenant.sharepoint.com/sites/teamsitewithlibraries
Functionalities
All Properties
Get-SPOList -IncludeAllProperties | Out-GridView
If you use the scrollbar below you can view all available properties:
Filtering data
Using the filter option you can select columns fulfilling certain criteria, e.g. all Document Libraries without versioning enabled:
Modifying view
Similarly to Excel, a double-click on the dividing line will expand the column width to fit the cell content. In order to limit the number of columns and view only those of interest to us, right-click on the column headers bar:
Setting the title
Get-SPOContentType | Out-GridView -Title "Content Types"
Examples
Items
Get-SPOListItems -ListTitle Not-Empty-Document-Library -IncludeAllProperties $true -Recursive | Out-GridView
Columns
Get-SPOListFields -ListTitle notaski11 | Out-GridView
Views
To pull all the views across the site and view them in the gridView:
$AllViews = New-Object System.Collections.Generic.List[System.Object]
foreach($list in (Get-SPOList).Title){ foreach($view in (Get-SPOListView -ListName $list -IncludeAllProperties)){ $Allviews.Add($view)}}
$Allviews | Out-GridView
Content Types
Get-SPOContentType | Out-GridView
Adding criteria to filter by id equal to a specific value you can also find a content type that may be hidden from the view but still throwing an error.