|
1 | | -function Set-SPOContentType |
2 | | -{ |
3 | | - |
4 | | - param ( |
5 | | - [Parameter(Mandatory=$true,Position=1)] |
| 1 | +function Set-SPOContentType{ |
| 2 | +param ( |
| 3 | +[Parameter(Mandatory=$true,Position=1)] |
6 | 4 | [string]$Username, |
7 | 5 | [Parameter(Mandatory=$true,Position=2)] |
8 | 6 | $AdminPassword, |
9 | | - [Parameter(Mandatory=$true,Position=3)] |
| 7 | +[Parameter(Mandatory=$true,Position=3)] |
10 | 8 | [string]$Url |
11 | | -) |
12 | | - |
13 | | - $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) |
14 | | - $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword) |
15 | | - $ctx.Load($ctx.Web.Lists) |
16 | | - $ctx.ExecuteQuery() |
17 | | - |
18 | | - |
19 | | - |
20 | | - foreach($ll in $ctx.Web.Lists) |
21 | | - { |
22 | | - Write-Host $ll.Title -ForegroundColor Green |
23 | | - $ctx.Load($ll.ContentTypes) |
24 | | - $ctx.ExecuteQuery() |
25 | | - foreach($cc in $ll.ContentTypes) |
26 | | - { |
27 | | - |
28 | | - if($cc.DisplayFormUrl -ne "") |
29 | | - { |
30 | | - Write-Host "Content type name: "$cc.Name |
31 | | - Write-Host "The Custom url: " $cc.DisplayFormUrl |
32 | | - } |
33 | | - # $cc.DisplayFormTemplateName="DocumentForm" |
34 | | - # $cc.Update($false) |
35 | | - # $ctx.ExecuteQuery() |
36 | | - |
37 | | - |
38 | | - |
39 | | - } |
40 | | - } |
41 | | - |
42 | | - |
43 | | - |
44 | | - $ctx.Dispose() |
45 | | - |
46 | | - |
47 | | - } |
| 9 | +) |
| 10 | + |
| 11 | + $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) |
| 12 | + $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword) |
| 13 | + $ctx.Load($ctx.Web.Lists) |
| 14 | + $ctx.ExecuteQuery() |
| 15 | + |
| 16 | + foreach($ll in $ctx.Web.Lists){ |
| 17 | + Write-Host $ll.Title -ForegroundColor Green |
| 18 | + $ctx.Load($ll.ContentTypes) |
| 19 | + $ctx.ExecuteQuery() |
| 20 | + foreach($cc in $ll.ContentTypes){ |
| 21 | + if($cc.DisplayFormUrl -ne ""){ |
| 22 | + Write-Host "Content type name: "$cc.Name |
| 23 | + Write-Host "The Custom url: " $cc.DisplayFormUrl |
| 24 | + } |
| 25 | + # $cc.DisplayFormTemplateName="DocumentForm" |
| 26 | +# $cc.Update($false) |
| 27 | + # $ctx.ExecuteQuery() |
| 28 | + } |
| 29 | + } |
| 30 | + |
| 31 | + $ctx.Dispose() |
| 32 | +} |
48 | 33 |
|
49 | 34 |
|
50 | 35 |
|
|
0 commit comments