Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
9105bed
Update description.md
JakubPiegza Jan 29, 2020
0f71c38
Update ContentTypeManagementSubsitesIncluded.ps1
JakubPiegza Jan 29, 2020
b3bc53f
Update GetCTNamesinAllLists.ps1
JakubPiegza Jan 30, 2020
48c51aa
Update GetCTNamesinAllLists.ps1
PowershellScripts Feb 11, 2020
d742b2b
Merge pull request #1 from PowershellScripts/develop
JakubPiegza Feb 26, 2020
9f37fd0
Update description.md
JakubPiegza Feb 27, 2020
a378981
Update ListAttachments.ps1
JakubPiegza Feb 27, 2020
1e7b953
Merge pull request #7 from JakubPiegza/patch-9
JakubPiegza Feb 27, 2020
be7ca5c
Merge pull request #6 from JakubPiegza/patch-7
JakubPiegza Feb 27, 2020
e31f9df
Merge pull request #5 from JakubPiegza/patch-6
JakubPiegza Feb 27, 2020
707a505
Merge pull request #4 from JakubPiegza/patch-5
JakubPiegza Feb 27, 2020
f1ba603
Merge pull request #3 from JakubPiegza/patch-53
JakubPiegza Feb 27, 2020
380e2e8
Merge pull request #2 from JakubPiegza/patch-4
JakubPiegza Feb 27, 2020
c2e74e5
Update description.md
JakubPiegza Mar 1, 2020
3a9fb03
Update SetLGforAllSites.ps1
JakubPiegza Mar 1, 2020
08d3122
Update description.md
JakubPiegza Mar 1, 2020
c6fdfe5
Update RemoveANDAddSPOWeb1.psm1
JakubPiegza Mar 1, 2020
47a4bde
Update description.md
JakubPiegza Mar 1, 2020
de44584
Update changecollection.ps1
JakubPiegza Mar 1, 2020
4f5c4a4
Update description.md
JakubPiegza Mar 1, 2020
04d29cd
Update changecollection.ps1
JakubPiegza Mar 1, 2020
81ced9d
Update description.md
JakubPiegza Mar 1, 2020
500366d
Update description.md
JakubPiegza Mar 1, 2020
799bb2b
Update AllowMasterPageEditing.ps1
JakubPiegza Mar 1, 2020
d223bc2
Update description.md
JakubPiegza Mar 1, 2020
f9c8657
Update SiteCollPropertiesWithCSOM.ps1
JakubPiegza Mar 1, 2020
e054505
Update description.md
JakubPiegza Mar 1, 2020
f0d81d8
Update enablefeatureForASingleSite.ps1
JakubPiegza Mar 1, 2020
b6d0b39
Update description.md
JakubPiegza Mar 1, 2020
385a6fe
Update enablefeature.ps1
JakubPiegza Mar 1, 2020
7fcbea5
Update description.md
JakubPiegza Mar 1, 2020
c8bf1fc
Update enablefeatureWithRecursion.ps1
JakubPiegza Mar 1, 2020
4917fd6
Update description.md
JakubPiegza Mar 1, 2020
b703e43
Update description.md
JakubPiegza Mar 1, 2020
3633ea2
Update AddFeaturesToPersonal.ps1
JakubPiegza Mar 1, 2020
7093575
Update enablefeature.ps1
JakubPiegza Mar 1, 2020
596f475
Update description.md
JakubPiegza Mar 1, 2020
c26cb7e
Update GetSPOSiteFeatures.ps1
JakubPiegza Mar 1, 2020
c7e11cf
Update description.md
JakubPiegza Mar 1, 2020
52665e1
Update GetSPOWebFeatures.ps1
JakubPiegza Mar 1, 2020
6ae172e
Update description.md
JakubPiegza Mar 1, 2020
b3bcaca
Update GetSPOAccessRequestsWithREST.ps1
JakubPiegza Mar 1, 2020
b17ede3
Update description.md
JakubPiegza Mar 1, 2020
52fbb2d
Update GetSPOAccessRequestsItemsWithREST.ps1
JakubPiegza Mar 1, 2020
3f47098
Update description.md
JakubPiegza Mar 1, 2020
4e6be24
Update GetSiteProperties.ps1
JakubPiegza Mar 1, 2020
4bcf2ee
Update description.md
JakubPiegza Mar 1, 2020
62a9ebb
Update GetSPServerAccessRequestsItemsWithREST.ps1
JakubPiegza Mar 1, 2020
38fdc07
Update description.md
JakubPiegza Mar 1, 2020
fe16765
Update description.md
JakubPiegza Mar 1, 2020
0d9b40a
Update GetAllSiteandSubsitesRecursive.ps1
JakubPiegza Mar 1, 2020
95789a8
Update description.md
JakubPiegza Mar 1, 2020
9a8259d
Update GetAllTimeZones.ps1
JakubPiegza Mar 1, 2020
96e5eb9
Update description.md
JakubPiegza Mar 1, 2020
a9d31f3
Update GetSPOWebModule.psm1
JakubPiegza Mar 1, 2020
064a92f
Update description.md
JakubPiegza Mar 1, 2020
8f8078f
Update description.md
JakubPiegza Mar 1, 2020
0b34d6e
Update SPOWebInheritance.psm1
JakubPiegza Mar 1, 2020
4f10453
Update description.md
JakubPiegza Mar 1, 2020
dd4d97a
Update Set-SPOWeb.psm1
JakubPiegza Mar 1, 2020
51222dd
Update description.md
JakubPiegza Mar 1, 2020
65788de
Update description.md
JakubPiegza Mar 1, 2020
65351da
Update MovingtoSecondStage.ps1
JakubPiegza Mar 1, 2020
bf476f9
Update RemovingSecondStage.ps1
JakubPiegza Mar 1, 2020
f44601d
Update description.md
JakubPiegza Mar 1, 2020
740dd19
Update DeleteAll.ps1
JakubPiegza Mar 1, 2020
49e0c8b
Update description.md
JakubPiegza Mar 1, 2020
ebba369
Update WhereIsMyFileWithDetails3.ps1
JakubPiegza Mar 1, 2020
ea08afa
Update description.md
JakubPiegza Mar 1, 2020
4920a65
Update ReportOnDeleted.ps1
JakubPiegza Mar 1, 2020
c6f2798
Update description.md
JakubPiegza Mar 1, 2020
d02d1d8
Update RestoreAllDeletedGroupFiles.ps1
JakubPiegza Mar 1, 2020
c85e121
Update description.md
JakubPiegza Mar 1, 2020
2a60108
Update description.md
JakubPiegza Mar 1, 2020
a63e994
Update WhereIsMyFileWithDetails3BasedRestore.ps1
JakubPiegza Mar 1, 2020
1419513
Update description.md
JakubPiegza Mar 1, 2020
0f44041
Update RestoreAllRecycleBinItems.ps1
JakubPiegza Mar 1, 2020
016779a
Update description.md
JakubPiegza Mar 1, 2020
6ddf1aa
Update RestoreDeletedItem.ps1
JakubPiegza Mar 1, 2020
a3f36bd
Update description.md
JakubPiegza Mar 1, 2020
286c51f
Update WhereIsMyFile.ps1
JakubPiegza Mar 1, 2020
63d0a8a
Update description.md
JakubPiegza Mar 1, 2020
a492c53
Update WithUnifiedGroups.ps1
JakubPiegza Mar 1, 2020
97ebe4d
Update Remove SPO subsite.ps1
JakubPiegza Mar 1, 2020
00628c8
Update description.md
JakubPiegza Mar 1, 2020
2dd8dfa
Update RequestEmailAddress.ps1
JakubPiegza Mar 1, 2020
70145f6
Update description.md
JakubPiegza Mar 1, 2020
f6a6dbe
Update Theme.ps1
JakubPiegza Mar 1, 2020
72673ae
Update description.md
JakubPiegza Mar 1, 2020
3fdeea6
Update description.md
JakubPiegza Mar 1, 2020
a47138f
Update LocaleID.ps1
JakubPiegza Mar 1, 2020
e19197a
Update PersonalRegSettings.ps1
JakubPiegza Mar 1, 2020
1a9e5dd
Delete description.md
PowershellScripts Aug 1, 2020
7d00f06
Delete AddFeaturesToPersonal.ps1
PowershellScripts Aug 1, 2020
074acb5
Delete description.md
PowershellScripts Aug 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ $Url="https://trialtrial123.sharepoint.com/sites/teamsitewithlists"
$ContentTypesEnabled=$true
```

###Please share your thoughts in the Q&A section!
### Please share your thoughts in the Q&A section!

####Related scripts</br>
#### Related scripts</br>
[Set direction of the reading order for a single list](https://gallery.technet.microsoft.com/office/Set-SPOList-properties-9d16f2ba)

[Set-SPOList properties (module)](https://gallery.technet.microsoft.com/scriptcenter/Disable-or-enable-12cf3795)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,52 @@
# Created by Arleta Wanat, 2015
#

function Set-SPOListsContentTypesEnabled
{
param (
[Parameter(Mandatory=$true,Position=1)]
function Set-SPOListsContentTypesEnabled{
param (
[Parameter(Mandatory=$true,Position=1)]
[string]$Username,
[Parameter(Mandatory=$true,Position=2)]
[string]$AdminPassword,
[Parameter(Mandatory=$true,Position=3)]
[Parameter(Mandatory=$true,Position=3)]
[string]$Url,
[Parameter(Mandatory=$true,Position=4)]
[Parameter(Mandatory=$true,Position=4)]
[bool]$ContentTypesEnabled
)

$password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $password)
$ctx.ExecuteQuery()

$Lists=$ctx.Web.Lists
$ctx.Load($ctx.Web)
$ctx.Load($ctx.Web.Webs)
$ctx.Load($Lists)
$ctx.ExecuteQuery()

Foreach($ll in $Lists)
{
$ll.ContentTypesEnabled = $ContentTypesEnabled
$ll.Update()


try
{
$ctx.ExecuteQuery()
Write-Host $ll.Title " Done" -ForegroundColor Green
}

catch [Net.WebException]
{

Write-Host "Failed" $_.Exception.ToString() -ForegroundColor Red
}
)

$password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $password)
$ctx.ExecuteQuery()

$Lists=$ctx.Web.Lists
$ctx.Load($ctx.Web)
$ctx.Load($ctx.Web.Webs)
$ctx.Load($Lists)
$ctx.ExecuteQuery()

Foreach($ll in $Lists){
$ll.ContentTypesEnabled = $ContentTypesEnabled
$ll.Update()

try{
$ctx.ExecuteQuery()
Write-Host $ll.Title " Done" -ForegroundColor Green
}
catch [Net.WebException]{
Write-Host "Failed" $_.Exception.ToString() -ForegroundColor Red
}
}

if($ctx.Web.Webs.Count -gt 0){
Write-Host "--"-ForegroundColor DarkGreen

for($i=0;$i -lt $ctx.Web.Webs.Count ;$i++){
Set-SPOListsContentTypesEnabled -Username $Username -Url $ctx.Web.Webs[$i].Url -AdminPassword $AdminPassword -ContentTypesEnabled $ContentTypesEnabled
}
}

}

if($ctx.Web.Webs.Count -gt 0)
{
Write-Host "--"-ForegroundColor DarkGreen
for($i=0;$i -lt $ctx.Web.Webs.Count ;$i++)
{
Set-SPOListsContentTypesEnabled -Username $Username -Url $ctx.Web.Webs[$i].Url -AdminPassword $AdminPassword -ContentTypesEnabled $ContentTypesEnabled
}
}

}




Expand All @@ -80,4 +71,4 @@ $ContentTypesEnabled=$true



Set-SPOListsContentTypesEnabled -Username $Username -AdminPassword $AdminPassword -Url $Url -ContentTypesEnabled $ContentTypesEnabled
Set-SPOListsContentTypesEnabled -Username $Username -AdminPassword $AdminPassword -Url $Url -ContentTypesEnabled $ContentTypesEnabled
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
A short Powershell script to allow management of content types for all SharePoint Online lists and libraries across all sites in a site collection



It is an equivalent of List>>List Settings>>Advanced>>Content types in Graphic User Interface (see screenshot)







It is an equivalent of **List**>>**List Settings**>>**Advanced**>>**Content types in Graphic User Interface** ([see screenshot](https://github.com/PowershellScripts/AllGalleryScriptsSamples/blob/develop/Content%20Types/Content%20Types%20Management%20Setting/Allow%20content%20type%20management%20for%20all%20lists%20in%20site%20collection/contentTypeManagement.png))


Applies to lists and libraries.





It requires installed SharePoint Online SDK
*It requires installed* [SharePoint Online SDK](www.microsoft.com/en-us/download/details.aspx?id=42038)

You have to enter the list information before running the script:



```PowerShell

# Paths to SDK. Please verify location on your computer.
Expand All @@ -36,33 +24,26 @@ $AdminPassword="Pass"
$Url="https://trialtrial123.sharepoint.com/sites/teamsitewithlists"
$ContentTypesEnabled=$true
```






Please share your thoughts in the Q&A section!


### Please share your thoughts in the Q&A section!

Wiki article with detailed code description:
#### Wiki article with detailed code description:


[SharePoint Online: Turn on support for multiple content types in a list or library using Powershell](http://social.technet.microsoft.com/wiki/contents/articles/30038.sharepoint-online-turn-on-support-for-multiple-content-types-in-a-list-or-library-using-powershell.aspx)



Related scripts
Set-SPOList properties (module)
#### Related scripts
[Set-SPOList properties (module)](https://gallery.technet.microsoft.com/office/Set-SPOList-properties-9d16f2ba)

Disable or enable attachments to list items using Powershell
[Disable or enable attachments to list items using Powershell](https://gallery.technet.microsoft.com/scriptcenter/Disable-or-enable-12cf3795)

Change search setting for all lists in a site using CSOM and Powershell
[Change search setting for all lists in a site using CSOM and Powershell](https://gallery.technet.microsoft.com/scriptcenter/Change-search-setting-for-8e842a48)

Allow content type management for all lists in a site using Powershell
[Allow content type management for all lists in a site using Powershell](https://gallery.technet.microsoft.com/scriptcenter/Allow-content-type-5bca5157)

Set content type management setting for SharePoint Online list using Powershell
[Set content type management setting for SharePoint Online list using Powershell](https://gallery.technet.microsoft.com/scriptcenter/Set-content-type-39ae4bce)


<br/><br/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,45 @@
# Created by Arleta Wanat, 2015
#

function Set-SPOList
{
param (
[Parameter(Mandatory=$true,Position=0)]
function Set-SPOList{
param(
[Parameter(Mandatory=$true,Position=0)]
[string]$ListName,
[Parameter(Mandatory=$true,Position=1)]
[Parameter(Mandatory=$true,Position=1)]
[bool]$ContentTypesEnabled
)
)

$ll=$ctx.Web.Lists.GetByTitle($ListName)
$ll=$ctx.Web.Lists.GetByTitle($ListName)

$ll.ContentTypesEnabled = $ContentTypesEnabled
$ll.Update()

try
{
$ctx.ExecuteQuery()
Write-Host "Done" -ForegroundColor Green
}

catch [Net.WebException]
{

Write-Host "Failed" $_.Exception.ToString() -ForegroundColor Red
}

$ll.ContentTypesEnabled = $ContentTypesEnabled
$ll.Update()

try{
$ctx.ExecuteQuery()
Write-Host "Done" -ForegroundColor Green
}
catch [Net.WebException]{
Write-Host "Failed" $_.Exception.ToString() -ForegroundColor Red
}
}




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


$password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $password)
$ctx.ExecuteQuery()
$global:ctx=$ctx
$password = ConvertTo-SecureString -string $AdminPassword -AsPlainText -Force
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $password)
$ctx.ExecuteQuery()
$global:ctx=$ctx
}


$global:ctx


Expand All @@ -77,4 +64,4 @@ $ContentTypesEnabled =$false

Connect-SPOCSOM -Username $Username -AdminPassword $AdminPassword -Url $Url

Set-SPOList -ListName $ListName -ContentTypesEnabled $ContentTypesEnabled
Set-SPOList -ListName $ListName -ContentTypesEnabled $ContentTypesEnabled
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ http://social.technet.microsoft.com/wiki/contents/articles/31051.sharepoint-onli

### How to use?

1. Download and install [SharePoint Online SDK](https://www.microsoft.com/en-us/download/details.aspx?id=42038).


1. Download and install SharePoint Online SDK.

2. Download the .ps1 file.
2. Download the *.ps1* file.

3. Open the file (you can do it also in NotePad)

Expand All @@ -33,15 +31,14 @@ $Name="Name of the Content Type2"
$ParentContentTypeID="0x01"
$Group="List Content Types"
```
a) Find on your computer where SharePoint.Clitent.dll and SharePoint.Client.Runtime.dll libraries are located and insert the correct paths
b) Instead of "admin@tenant.onmicrosoft.com" enter you username
c) Instead of "https://tenant.sharepoint.com/sites/teamsitewithlibraries" enter the name of the site collection where you want to find the content types
d) Fill in the properties of the content type.
a) Find on your computer where SharePoint.Clitent.dll and SharePoint.Client.Runtime.dll libraries are located and insert the correct paths</br>
b) Instead of "admin@tenant.onmicrosoft.com" enter you username</br>
c) Instead of "https://tenant.sharepoint.com/sites/teamsitewithlibraries" enter the name of the site collection where you want to find the content types</br>
d) Fill in the properties of the content type.</br>


5. Run the script in Powershell (any module).

6. When the script has executed, Powershell will show a message Content Type Name of the Content Type2 has been added to Title of the List.
6. When the script has executed, Powershell will show a message *Content Type Name of the Content Type2 has been added to Title of the List*.

<br/><br/>
<b>Enjoy and please share feedback!</b>
Loading