|
1 | | -. |
| 1 | +New SharePoint Online Powershell cmdlet Get-SPOAllList which allows you to view and filter SPO list properties. |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +There is no equivalent in Graphic User Interface (GUI) of this cmdlet |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +## *Parameters* |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +The cmdlet is using the following parameters: |
| 14 | +``` |
| 15 | + [string]$Username |
| 16 | + ``` |
| 17 | +The string specifies admin of the site |
| 18 | +``` |
| 19 | +[string]$Url |
| 20 | +``` |
| 21 | +Specifies the url of a site where you have the list |
| 22 | +``` |
| 23 | +[string]$AdminPassword, |
| 24 | +``` |
| 25 | +Admin's password |
| 26 | +``` |
| 27 | +[bool]$IncludeSubsites=$false |
| 28 | +``` |
| 29 | +Specifies whether the cmdlet should check for lists in the subsites as well, by default it is set to $false |
| 30 | +``` |
| 31 | +[bool]$IncludeAllProperties=$false |
| 32 | +``` |
| 33 | +Specifies whether you should view all the available properties or just the Title, Url and Created Date. By the default it is set to $false. |
| 34 | + |
| 35 | +<hr> |
| 36 | + |
| 37 | +## *Requirements* |
| 38 | + |
| 39 | +The following libraries (SharePoint Online SDK) are required. If those libraries are in different location on your computer, please edit the .psm1 file! |
| 40 | + |
| 41 | + |
| 42 | +```powershell |
| 43 | +# Paths to SDK. Please verify location on your computer. |
| 44 | +Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll" |
| 45 | +Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" |
| 46 | +``` |
| 47 | +<hr> |
| 48 | + |
| 49 | +## *Examples* |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | ++ Get a list of all lists and libraries in a site |
| 54 | +```powershell |
| 55 | +Get-SPOList -Username user@domain.com -Url https://domain.sharepoint.com/sites/sitecollection/subsite -AdminPassword Pass |
| 56 | +``` |
| 57 | +<img src="../GetSPOList Module to view and filter SPO list properties/GETSPOALLListsNoProperties.PNG" width="850"> |
| 58 | + |
| 59 | +<br/> |
| 60 | + |
| 61 | ++ Get a list of all lists and libraries in a site collection and its subsites |
| 62 | +```powershell |
| 63 | +Get-SPOList -Username user@domain.com -Url https://domain.sharepoint.com/sites/sitecollection/subsite -AdminPassword Pass -IncludeSubsites $true |
| 64 | +``` |
| 65 | + |
| 66 | + |
| 67 | ++ Export to CSV a list of all lists and libraries in a site collection and its subsites |
| 68 | +```powershell |
| 69 | +Get-SPOList -Username user@domain.com -Url https://domain.sharepoint.com/sites/sitecollection/subsite -AdminPassword Pass -IncludeSubsites $true | export-CSV -path c:\csv.csv |
| 70 | +``` |
| 71 | + |
| 72 | + |
| 73 | ++ Get a list of all lists and libraries with all their properties |
| 74 | +```powershell |
| 75 | +Get-SPOList -Username user@domain.com -Url https://domain.sharepoint.com -AdminPassword Pass -IncludeAllProperties $true |
| 76 | +``` |
| 77 | + <img src="../GetSPOList Module to view and filter SPO list properties/GetSPOALLLists.PNG" width="850"> |
| 78 | + |
| 79 | + |
| 80 | ++ Get a specific list |
| 81 | +```powershell |
| 82 | +Get-SPOList -Username user@domain.com -Url https://domain.sharepoint.com -AdminPassword Pass -IncludeAllProperties $true | where {$_.Title -eq "ccc"} |
| 83 | +``` |
| 84 | + |
| 85 | +<img src="../GetSPOList Module to view and filter SPO list properties/GetSPOListOne.PNG" width="850"> |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | ++ Get lists based on criteria |
| 93 | +```powershell |
| 94 | +Get-SPOList -Username user@domain.com -Url https://domain.sharepoint.com -AdminPassword Pass -IncludeAllProperties $true | where {$_.Hidden -eq $true} | select Title, Created |
| 95 | +``` |
| 96 | + |
| 97 | +<img src="../GetSPOList Module to view and filter SPO list properties/GetSPOALLListsHidden.PNG" width="850"> |
| 98 | + |
| 99 | + |
| 100 | ++ Get all document libraries |
| 101 | + |
| 102 | +The property that defines the type of list/library is called **BaseTemplate**. For all the ids check the [MSDN List Template Types](https://docs.microsoft.com/en-us/openspecs/sharepoint_protocols/ms-wssts/8bf797af-288c-4a1d-a14b-cf5394e636cf?redirectedfrom=MSDN) |
| 103 | + |
| 104 | +Get-SPOList -Username user@domain.com -Url https://domain.sharepoint.com -AdminPassword Pass -IncludeAllProperties $true | where {$_.BaseTemplate -eq 101} | select Title, Created |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | ++ Get all lists and their corresponding types |
| 109 | + |
| 110 | +The property that defines the type of list/library is called **BaseTemplate**. For all the ids check the [MSDN List Template Types](https://docs.microsoft.com/en-us/openspecs/sharepoint_protocols/ms-wssts/8bf797af-288c-4a1d-a14b-cf5394e636cf?redirectedfrom=MSDN) |
| 111 | + |
| 112 | +Get-SPOList -Username user@domain.com -Url https://domain.sharepoint.com -AdminPassword Pass -IncludeAllProperties $true | where {$_.BaseTemplate -eq 101} | select Title, Created |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + <img src="../GetSPOList Module to view and filter SPO list properties/GetListTemplates.PNG" width="850"> |
| 117 | + |
| 118 | +<hr> |
| 119 | + |
| 120 | +# **How not to use the cmdlet:** |
| 121 | + |
| 122 | +Get-SPOList -Username user@domain.com -Url https://domain.sharepoint.com -AdminPassword Pass | where {$_.Hidden -eq $false} |
| 123 | + |
| 124 | +<img src="../GetSPOList Module to view and filter SPO list properties/NOTTO.PNG" width="850"> |
| 125 | + |
| 126 | +<font color="red">If you don't load the properties, you cannot search by them!</font> |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | +<br/><br/> |
| 131 | +<b>Enjoy and please share feedback!</b> |
| 132 | + |
0 commit comments