Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update GetCTNamesinAllLists.ps1
  • Loading branch information
JakubPiegza authored Jan 30, 2020
commit b3bc53f7b9c36b4d3de5113e16e15a007d47da6c
Original file line number Diff line number Diff line change
@@ -1,64 +1,42 @@

function Get-SPOList
{

param (
[Parameter(Mandatory=$true,Position=1)]
function Get-SPOList{
param (
[Parameter(Mandatory=$true,Position=1)]
[string]$Username,
[Parameter(Mandatory=$true,Position=2)]
$AdminPassword,
[Parameter(Mandatory=$true,Position=3)]
[Parameter(Mandatory=$true,Position=3)]
[string]$Url
)

$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
$ctx.ExecuteQuery()

$ctx.Load($ctx.Web.Lists)
$ctx.ExecuteQuery()
Write-Host
Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen
foreach( $ll in $ctx.Web.Lists)
{
)

$ctx.Load($ll.ContentTypes)
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)
$ctx.ExecuteQuery()

try
{
$ctx.ExecuteQuery()
}
catch
{
}
$ctx.Load($ctx.Web.Lists)
$ctx.ExecuteQuery()
Write-Host
Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen

foreach( $ll in $ctx.Web.Lists){
$ctx.Load($ll.ContentTypes)



Write-Host $ll.Title -ForegroundColor Green

foreach($cc in $ll.ContentTypes)
{
Write-Output $cc.Name
}
try{
$ctx.ExecuteQuery()
}
catch{}



Write-Host $ll.Title -ForegroundColor Green



}



}


foreach($cc in $ll.ContentTypes){
Write-Output $cc.Name
}

}
}






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


Get-SPOList -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl
Get-SPOList -Username $Username -AdminPassword $AdminPassword -Url $AdminUrl