Skip to content

Commit f1ba603

Browse files
authored
Merge pull request #3 from JakubPiegza/patch-53
Patch 53
2 parents 707a505 + 48c51aa commit f1ba603

File tree

1 file changed

+27
-50
lines changed

1 file changed

+27
-50
lines changed
Lines changed: 27 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,41 @@
1-
2-
3-
function Get-SPOList
4-
{
5-
6-
param (
7-
[Parameter(Mandatory=$true,Position=1)]
1+
function Get-SPOList{
2+
param (
3+
[Parameter(Mandatory=$true,Position=1)]
84
[string]$Username,
95
[Parameter(Mandatory=$true,Position=2)]
106
$AdminPassword,
11-
[Parameter(Mandatory=$true,Position=3)]
7+
[Parameter(Mandatory=$true,Position=3)]
128
[string]$Url
13-
)
14-
15-
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
16-
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
17-
$ctx.ExecuteQuery()
18-
19-
$ctx.Load($ctx.Web.Lists)
20-
$ctx.ExecuteQuery()
21-
Write-Host
22-
Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen
23-
foreach( $ll in $ctx.Web.Lists)
24-
{
9+
)
2510

26-
$ctx.Load($ll.ContentTypes)
11+
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
12+
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
13+
$ctx.ExecuteQuery()
2714

28-
try
29-
{
30-
$ctx.ExecuteQuery()
31-
}
32-
catch
33-
{
34-
}
15+
$ctx.Load($ctx.Web.Lists)
16+
$ctx.ExecuteQuery()
17+
Write-Host
18+
Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen
3519

20+
foreach( $ll in $ctx.Web.Lists){
21+
$ctx.Load($ll.ContentTypes)
3622

37-
23+
try{
24+
$ctx.ExecuteQuery()
25+
}
26+
catch{
27+
}
3828

39-
Write-Host $ll.Title -ForegroundColor Green
40-
41-
foreach($cc in $ll.ContentTypes)
42-
{
43-
Write-Output $cc.Name
44-
}
29+
Write-Host $ll.Title -ForegroundColor Green
4530

46-
47-
31+
foreach($cc in $ll.ContentTypes){
32+
Write-Output $cc.Name
33+
}
4834

49-
50-
51-
}
52-
53-
54-
55-
}
56-
57-
58-
59-
60-
35+
}
36+
}
6137

38+
6239

6340

6441
# Paths to SDK. Please verify location on your computer.
@@ -71,4 +48,4 @@ $AdminPassword=Read-Host -Prompt "Password" -AsSecureString
7148
$AdminUrl="https://tenant.sharepoint.com/sites/teamsitewithlibraries"
7249

7350

74-
Get-SPOList -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl
51+
Get-SPOList -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl

0 commit comments

Comments
 (0)