Skip to content

Commit 4e6be24

Browse files
authored
Update GetSiteProperties.ps1
1 parent 3f47098 commit 4e6be24

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed
Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
1-
function Get-SPOSiteProperties
2-
{
3-
4-
param (
5-
[Parameter(Mandatory=$true,Position=1)]
1+
function Get-SPOSiteProperties{
2+
param (
3+
[Parameter(Mandatory=$true,Position=1)]
64
[string]$Username,
7-
[Parameter(Mandatory=$true,Position=2)]
5+
[Parameter(Mandatory=$true,Position=2)]
86
$AdminPassword,
9-
[Parameter(Mandatory=$true,Position=3)]
7+
[Parameter(Mandatory=$true,Position=3)]
108
[string]$Url
11-
)
12-
13-
# Connect and load all prerequisites
14-
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
15-
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials ($Username, $AdminPassword)
16-
$ctx.ExecuteQuery()
17-
$ctx.Load($ctx.Web)
18-
$ctx.Load($ctx.Web.AllProperties)
19-
$ctx.ExecuteQuery()
9+
)
2010

21-
foreach ($ap in $ctx.Web.AllProperties.FieldValues)
22-
{
23-
Write-Output $ap
24-
}
11+
# Connect and load all prerequisites
12+
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
13+
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials ($Username, $AdminPassword)
14+
$ctx.ExecuteQuery()
15+
$ctx.Load($ctx.Web)
16+
$ctx.Load($ctx.Web.AllProperties)
17+
$ctx.ExecuteQuery()
2518

26-
}
19+
foreach ($ap in $ctx.Web.AllProperties.FieldValues){
20+
Write-Output $ap
21+
}
22+
}
2723

2824

2925

@@ -39,4 +35,4 @@ $SiteUrl="https://trial345.sharepoint.com/sites/teamsitewithlibraries"
3935

4036

4137

42-
Get-SPOSiteProperties -Username $Username -AdminPassword $AdminPassword -Url $SiteUrl
38+
Get-SPOSiteProperties -Username $Username -AdminPassword $AdminPassword -Url $SiteUrl

0 commit comments

Comments
 (0)